source("pairs.r")


library(dplyr)
library(ggplot2)
library(pastecs)
library(psych)
library(Amelia)
library(mlbench)
library(corrplot)
library(caret)
library(readr)
library(gridExtra)
library(grid)
library(ggplot2)
library(lattice)
library(leaps)

Load data

data <- read_csv("data/WA_Fn-UseC_-HR-Employee-Attrition.csv")
Parsed with column specification:
cols(
  .default = col_double(),
  Attrition = col_character(),
  BusinessTravel = col_character(),
  Department = col_character(),
  EducationField = col_character(),
  Gender = col_character(),
  JobRole = col_character(),
  MaritalStatus = col_character(),
  Over18 = col_character(),
  OverTime = col_character()
)
See spec(...) for full column specifications.
head(data)

Summarize Data

names(data)
 [1] "Age"                      "Attrition"                "BusinessTravel"           "DailyRate"               
 [5] "Department"               "DistanceFromHome"         "Education"                "EducationField"          
 [9] "EmployeeCount"            "EmployeeNumber"           "EnvironmentSatisfaction"  "Gender"                  
[13] "HourlyRate"               "JobInvolvement"           "JobLevel"                 "JobRole"                 
[17] "JobSatisfaction"          "MaritalStatus"            "MonthlyIncome"            "MonthlyRate"             
[21] "NumCompaniesWorked"       "Over18"                   "OverTime"                 "PercentSalaryHike"       
[25] "PerformanceRating"        "RelationshipSatisfaction" "StandardHours"            "StockOptionLevel"        
[29] "TotalWorkingYears"        "TrainingTimesLastYear"    "WorkLifeBalance"          "YearsAtCompany"          
[33] "YearsInCurrentRole"       "YearsSinceLastPromotion"  "YearsWithCurrManager"    
summary(data)
      Age         Attrition         BusinessTravel       DailyRate       Department        DistanceFromHome   Education    
 Min.   :18.00   Length:1470        Length:1470        Min.   : 102.0   Length:1470        Min.   : 1.000   Min.   :1.000  
 1st Qu.:30.00   Class :character   Class :character   1st Qu.: 465.0   Class :character   1st Qu.: 2.000   1st Qu.:2.000  
 Median :36.00   Mode  :character   Mode  :character   Median : 802.0   Mode  :character   Median : 7.000   Median :3.000  
 Mean   :36.92                                         Mean   : 802.5                      Mean   : 9.193   Mean   :2.913  
 3rd Qu.:43.00                                         3rd Qu.:1157.0                      3rd Qu.:14.000   3rd Qu.:4.000  
 Max.   :60.00                                         Max.   :1499.0                      Max.   :29.000   Max.   :5.000  
 EducationField     EmployeeCount EmployeeNumber   EnvironmentSatisfaction    Gender            HourlyRate    
 Length:1470        Min.   :1     Min.   :   1.0   Min.   :1.000           Length:1470        Min.   : 30.00  
 Class :character   1st Qu.:1     1st Qu.: 491.2   1st Qu.:2.000           Class :character   1st Qu.: 48.00  
 Mode  :character   Median :1     Median :1020.5   Median :3.000           Mode  :character   Median : 66.00  
                    Mean   :1     Mean   :1024.9   Mean   :2.722                              Mean   : 65.89  
                    3rd Qu.:1     3rd Qu.:1555.8   3rd Qu.:4.000                              3rd Qu.: 83.75  
                    Max.   :1     Max.   :2068.0   Max.   :4.000                              Max.   :100.00  
 JobInvolvement    JobLevel       JobRole          JobSatisfaction MaritalStatus      MonthlyIncome    MonthlyRate   
 Min.   :1.00   Min.   :1.000   Length:1470        Min.   :1.000   Length:1470        Min.   : 1009   Min.   : 2094  
 1st Qu.:2.00   1st Qu.:1.000   Class :character   1st Qu.:2.000   Class :character   1st Qu.: 2911   1st Qu.: 8047  
 Median :3.00   Median :2.000   Mode  :character   Median :3.000   Mode  :character   Median : 4919   Median :14236  
 Mean   :2.73   Mean   :2.064                      Mean   :2.729                      Mean   : 6503   Mean   :14313  
 3rd Qu.:3.00   3rd Qu.:3.000                      3rd Qu.:4.000                      3rd Qu.: 8379   3rd Qu.:20462  
 Max.   :4.00   Max.   :5.000                      Max.   :4.000                      Max.   :19999   Max.   :26999  
 NumCompaniesWorked    Over18            OverTime         PercentSalaryHike PerformanceRating RelationshipSatisfaction
 Min.   :0.000      Length:1470        Length:1470        Min.   :11.00     Min.   :3.000     Min.   :1.000           
 1st Qu.:1.000      Class :character   Class :character   1st Qu.:12.00     1st Qu.:3.000     1st Qu.:2.000           
 Median :2.000      Mode  :character   Mode  :character   Median :14.00     Median :3.000     Median :3.000           
 Mean   :2.693                                            Mean   :15.21     Mean   :3.154     Mean   :2.712           
 3rd Qu.:4.000                                            3rd Qu.:18.00     3rd Qu.:3.000     3rd Qu.:4.000           
 Max.   :9.000                                            Max.   :25.00     Max.   :4.000     Max.   :4.000           
 StandardHours StockOptionLevel TotalWorkingYears TrainingTimesLastYear WorkLifeBalance YearsAtCompany   YearsInCurrentRole
 Min.   :80    Min.   :0.0000   Min.   : 0.00     Min.   :0.000         Min.   :1.000   Min.   : 0.000   Min.   : 0.000    
 1st Qu.:80    1st Qu.:0.0000   1st Qu.: 6.00     1st Qu.:2.000         1st Qu.:2.000   1st Qu.: 3.000   1st Qu.: 2.000    
 Median :80    Median :1.0000   Median :10.00     Median :3.000         Median :3.000   Median : 5.000   Median : 3.000    
 Mean   :80    Mean   :0.7939   Mean   :11.28     Mean   :2.799         Mean   :2.761   Mean   : 7.008   Mean   : 4.229    
 3rd Qu.:80    3rd Qu.:1.0000   3rd Qu.:15.00     3rd Qu.:3.000         3rd Qu.:3.000   3rd Qu.: 9.000   3rd Qu.: 7.000    
 Max.   :80    Max.   :3.0000   Max.   :40.00     Max.   :6.000         Max.   :4.000   Max.   :40.000   Max.   :18.000    
 YearsSinceLastPromotion YearsWithCurrManager
 Min.   : 0.000          Min.   : 0.000      
 1st Qu.: 0.000          1st Qu.: 2.000      
 Median : 1.000          Median : 3.000      
 Mean   : 2.188          Mean   : 4.123      
 3rd Qu.: 3.000          3rd Qu.: 7.000      
 Max.   :15.000          Max.   :17.000      

Clean and Format Data

#####################################
##
## Reformat the data so that it is
## 1) Easy to use (add nice column names)
## 2) Interpreted correctly by glm()..
##
#####################################

data$Attrition <- ifelse(data$Attrition == "Yes", 1, 0)
data$Attrition <- factor(data$Attrition, levels = c(0, 1))

data$Over18 <- ifelse(data$Over18 == "Y", 1, 0)
data$Over18 <- factor(data$Over18, levels = c(0, 1))

data$OverTime <- ifelse(data$OverTime == "Yes", 1, 0)
data$OverTime <- factor(data$OverTime, levels = c(0, 1))

data$BusinessTravel<-factor(data$BusinessTravel)
data$Department<-factor(data$Department)
data$EducationField<-factor(data$EducationField)
data$Gender<-factor(data$Gender)
data$MaritalStatus<-factor(data$MaritalStatus)
data$JobRole<-factor(data$JobRole)

data$Education<-factor(data$Education, order = TRUE, levels=c(1,2,3,4,5))
data$EnvironmentSatisfaction<-factor(data$EnvironmentSatisfaction, order=TRUE, levels=c(1,2,3,4))
data$JobInvolvement<-factor(data$JobInvolvement, order=TRUE, levels=c(1,2,3,4))
data$JobSatisfaction<-factor(data$JobSatisfaction, order=TRUE, levels=c(1,2,3,4))
data$PerformanceRating<-factor(data$PerformanceRating, order=TRUE, levels=c(1,2,3,4))
data$RelationshipSatisfaction<-factor(data$RelationshipSatisfaction, order=TRUE, levels=c(1,2,3,4))
data$WorkLifeBalance<-factor(data$WorkLifeBalance, order=TRUE, levels=c(1,2,3,4))
data$StockOptionLevel<-factor(data$StockOptionLevel, order=TRUE, levels=c(0,1,2,3))

original.data<-data

Describe Data

stat.desc(data)
describe(data)
str(data)
Classes ‘spec_tbl_df’, ‘tbl_df’, ‘tbl’ and 'data.frame':    1470 obs. of  35 variables:
 $ Age                     : num  41 49 37 33 27 32 59 30 38 36 ...
 $ Attrition               : Factor w/ 2 levels "0","1": 2 1 2 1 1 1 1 1 1 1 ...
 $ BusinessTravel          : Factor w/ 3 levels "Non-Travel","Travel_Frequently",..: 3 2 3 2 3 2 3 3 2 3 ...
 $ DailyRate               : num  1102 279 1373 1392 591 ...
 $ Department              : Factor w/ 3 levels "Human Resources",..: 3 2 2 2 2 2 2 2 2 2 ...
 $ DistanceFromHome        : num  1 8 2 3 2 2 3 24 23 27 ...
 $ Education               : Ord.factor w/ 5 levels "1"<"2"<"3"<"4"<..: 2 1 2 4 1 2 3 1 3 3 ...
 $ EducationField          : Factor w/ 6 levels "Human Resources",..: 2 2 5 2 4 2 4 2 2 4 ...
 $ EmployeeCount           : num  1 1 1 1 1 1 1 1 1 1 ...
 $ EmployeeNumber          : num  1 2 4 5 7 8 10 11 12 13 ...
 $ EnvironmentSatisfaction : Ord.factor w/ 4 levels "1"<"2"<"3"<"4": 2 3 4 4 1 4 3 4 4 3 ...
 $ Gender                  : Factor w/ 2 levels "Female","Male": 1 2 2 1 2 2 1 2 2 2 ...
 $ HourlyRate              : num  94 61 92 56 40 79 81 67 44 94 ...
 $ JobInvolvement          : Ord.factor w/ 4 levels "1"<"2"<"3"<"4": 3 2 2 3 3 3 4 3 2 3 ...
 $ JobLevel                : num  2 2 1 1 1 1 1 1 3 2 ...
 $ JobRole                 : Factor w/ 9 levels "Healthcare Representative",..: 8 7 3 7 3 3 3 3 5 1 ...
 $ JobSatisfaction         : Ord.factor w/ 4 levels "1"<"2"<"3"<"4": 4 2 3 3 2 4 1 3 3 3 ...
 $ MaritalStatus           : Factor w/ 3 levels "Divorced","Married",..: 3 2 3 2 2 3 2 1 3 2 ...
 $ MonthlyIncome           : num  5993 5130 2090 2909 3468 ...
 $ MonthlyRate             : num  19479 24907 2396 23159 16632 ...
 $ NumCompaniesWorked      : num  8 1 6 1 9 0 4 1 0 6 ...
 $ Over18                  : Factor w/ 2 levels "0","1": 2 2 2 2 2 2 2 2 2 2 ...
 $ OverTime                : Factor w/ 2 levels "0","1": 2 1 2 2 1 1 2 1 1 1 ...
 $ PercentSalaryHike       : num  11 23 15 11 12 13 20 22 21 13 ...
 $ PerformanceRating       : Ord.factor w/ 4 levels "1"<"2"<"3"<"4": 3 4 3 3 3 3 4 4 4 3 ...
 $ RelationshipSatisfaction: Ord.factor w/ 4 levels "1"<"2"<"3"<"4": 1 4 2 3 4 3 1 2 2 2 ...
 $ StandardHours           : num  80 80 80 80 80 80 80 80 80 80 ...
 $ StockOptionLevel        : Ord.factor w/ 4 levels "0"<"1"<"2"<"3": 1 2 1 1 2 1 4 2 1 3 ...
 $ TotalWorkingYears       : num  8 10 7 8 6 8 12 1 10 17 ...
 $ TrainingTimesLastYear   : num  0 3 3 3 3 2 3 2 2 3 ...
 $ WorkLifeBalance         : Ord.factor w/ 4 levels "1"<"2"<"3"<"4": 1 3 3 3 3 2 2 3 3 2 ...
 $ YearsAtCompany          : num  6 10 0 8 2 7 1 1 9 7 ...
 $ YearsInCurrentRole      : num  4 7 0 7 2 7 0 0 7 7 ...
 $ YearsSinceLastPromotion : num  0 1 0 3 2 3 0 0 1 7 ...
 $ YearsWithCurrManager    : num  5 7 0 0 2 6 0 0 8 7 ...
 - attr(*, "spec")=
  .. cols(
  ..   Age = col_double(),
  ..   Attrition = col_character(),
  ..   BusinessTravel = col_character(),
  ..   DailyRate = col_double(),
  ..   Department = col_character(),
  ..   DistanceFromHome = col_double(),
  ..   Education = col_double(),
  ..   EducationField = col_character(),
  ..   EmployeeCount = col_double(),
  ..   EmployeeNumber = col_double(),
  ..   EnvironmentSatisfaction = col_double(),
  ..   Gender = col_character(),
  ..   HourlyRate = col_double(),
  ..   JobInvolvement = col_double(),
  ..   JobLevel = col_double(),
  ..   JobRole = col_character(),
  ..   JobSatisfaction = col_double(),
  ..   MaritalStatus = col_character(),
  ..   MonthlyIncome = col_double(),
  ..   MonthlyRate = col_double(),
  ..   NumCompaniesWorked = col_double(),
  ..   Over18 = col_character(),
  ..   OverTime = col_character(),
  ..   PercentSalaryHike = col_double(),
  ..   PerformanceRating = col_double(),
  ..   RelationshipSatisfaction = col_double(),
  ..   StandardHours = col_double(),
  ..   StockOptionLevel = col_double(),
  ..   TotalWorkingYears = col_double(),
  ..   TrainingTimesLastYear = col_double(),
  ..   WorkLifeBalance = col_double(),
  ..   YearsAtCompany = col_double(),
  ..   YearsInCurrentRole = col_double(),
  ..   YearsSinceLastPromotion = col_double(),
  ..   YearsWithCurrManager = col_double()
  .. )
summary(data)
      Age        Attrition           BusinessTravel   DailyRate                       Department  DistanceFromHome
 Min.   :18.00   0:1233    Non-Travel       : 150   Min.   : 102.0   Human Resources       : 63   Min.   : 1.000  
 1st Qu.:30.00   1: 237    Travel_Frequently: 277   1st Qu.: 465.0   Research & Development:961   1st Qu.: 2.000  
 Median :36.00             Travel_Rarely    :1043   Median : 802.0   Sales                 :446   Median : 7.000  
 Mean   :36.92                                      Mean   : 802.5                                Mean   : 9.193  
 3rd Qu.:43.00                                      3rd Qu.:1157.0                                3rd Qu.:14.000  
 Max.   :60.00                                      Max.   :1499.0                                Max.   :29.000  
                                                                                                                  
 Education          EducationField EmployeeCount EmployeeNumber   EnvironmentSatisfaction    Gender      HourlyRate    
 1:170     Human Resources : 27    Min.   :1     Min.   :   1.0   1:284                   Female:588   Min.   : 30.00  
 2:282     Life Sciences   :606    1st Qu.:1     1st Qu.: 491.2   2:287                   Male  :882   1st Qu.: 48.00  
 3:572     Marketing       :159    Median :1     Median :1020.5   3:453                                Median : 66.00  
 4:398     Medical         :464    Mean   :1     Mean   :1024.9   4:446                                Mean   : 65.89  
 5: 48     Other           : 82    3rd Qu.:1     3rd Qu.:1555.8                                        3rd Qu.: 83.75  
           Technical Degree:132    Max.   :1     Max.   :2068.0                                        Max.   :100.00  
                                                                                                                       
 JobInvolvement    JobLevel                          JobRole    JobSatisfaction  MaritalStatus MonthlyIncome  
 1: 83          Min.   :1.000   Sales Executive          :326   1:289           Divorced:327   Min.   : 1009  
 2:375          1st Qu.:1.000   Research Scientist       :292   2:280           Married :673   1st Qu.: 2911  
 3:868          Median :2.000   Laboratory Technician    :259   3:442           Single  :470   Median : 4919  
 4:144          Mean   :2.064   Manufacturing Director   :145   4:459                          Mean   : 6503  
                3rd Qu.:3.000   Healthcare Representative:131                                  3rd Qu.: 8379  
                Max.   :5.000   Manager                  :102                                  Max.   :19999  
                                (Other)                  :215                                                 
  MonthlyRate    NumCompaniesWorked Over18   OverTime PercentSalaryHike PerformanceRating RelationshipSatisfaction
 Min.   : 2094   Min.   :0.000      0:   0   0:1054   Min.   :11.00     1:   0            1:276                   
 1st Qu.: 8047   1st Qu.:1.000      1:1470   1: 416   1st Qu.:12.00     2:   0            2:303                   
 Median :14236   Median :2.000                        Median :14.00     3:1244            3:459                   
 Mean   :14313   Mean   :2.693                        Mean   :15.21     4: 226            4:432                   
 3rd Qu.:20462   3rd Qu.:4.000                        3rd Qu.:18.00                                               
 Max.   :26999   Max.   :9.000                        Max.   :25.00                                               
                                                                                                                  
 StandardHours StockOptionLevel TotalWorkingYears TrainingTimesLastYear WorkLifeBalance YearsAtCompany   YearsInCurrentRole
 Min.   :80    0:631            Min.   : 0.00     Min.   :0.000         1: 80           Min.   : 0.000   Min.   : 0.000    
 1st Qu.:80    1:596            1st Qu.: 6.00     1st Qu.:2.000         2:344           1st Qu.: 3.000   1st Qu.: 2.000    
 Median :80    2:158            Median :10.00     Median :3.000         3:893           Median : 5.000   Median : 3.000    
 Mean   :80    3: 85            Mean   :11.28     Mean   :2.799         4:153           Mean   : 7.008   Mean   : 4.229    
 3rd Qu.:80                     3rd Qu.:15.00     3rd Qu.:3.000                         3rd Qu.: 9.000   3rd Qu.: 7.000    
 Max.   :80                     Max.   :40.00     Max.   :6.000                         Max.   :40.000   Max.   :18.000    
                                                                                                                           
 YearsSinceLastPromotion YearsWithCurrManager
 Min.   : 0.000          Min.   : 0.000      
 1st Qu.: 0.000          1st Qu.: 2.000      
 Median : 1.000          Median : 3.000      
 Mean   : 2.188          Mean   : 4.123      
 3rd Qu.: 3.000          3rd Qu.: 7.000      
 Max.   :15.000          Max.   :17.000      
                                             

Plot all Data Features Against Attrition

for(i in 1:length(data)) {
  plot(data$Attrition, eval(parse(text=paste("data",names(data)[i],sep="$"))), xlab = "Attrition", ylab = names(data)[i])
}

Plot Missing Data

help(missmap)
options(repr.plot.width = 24, repr.plot.height = 24)
missmap(data, col=c("blue", "red"), legend=TRUE)
the condition has length > 1 and only the first element will be usedUnknown or uninitialised column: 'arguments'.Unknown or uninitialised column: 'arguments'.Unknown or uninitialised column: 'imputations'.

Plot Correlations

options(repr.plot.width = 16, repr.plot.height = 16)
num_data <- data[, sapply(data, is.numeric)]
stat.desc(num_data)
correlations <- cor(num_data)
the standard deviation is zero
corrplot(correlations, method="circle")

# View(data)
plot(data[c(2,1,3,4,5)])

plot(data[c(2,6,7,8,9)])

plot(data[c(2,10,11,12,13)])

plot(data[c(2,14,15,16,17)])

plot(data[c(2,18,19,20,21)])

plot(data[c(2,22,23,24,25)])

plot(data[c(2,26,27,28,29)])

plot(data[c(2,30,31,32,33)])

plot(data[c(2,34,35)])

Summarize Categorical Data

cat_data <- data[, sapply(data, is.factor)]
summary(cat_data)
 Attrition           BusinessTravel                  Department  Education          EducationField EnvironmentSatisfaction
 0:1233    Non-Travel       : 150   Human Resources       : 63   1:170     Human Resources : 27    1:284                  
 1: 237    Travel_Frequently: 277   Research & Development:961   2:282     Life Sciences   :606    2:287                  
           Travel_Rarely    :1043   Sales                 :446   3:572     Marketing       :159    3:453                  
                                                                 4:398     Medical         :464    4:446                  
                                                                 5: 48     Other           : 82                           
                                                                           Technical Degree:132                           
                                                                                                                          
    Gender    JobInvolvement                      JobRole    JobSatisfaction  MaritalStatus Over18   OverTime
 Female:588   1: 83          Sales Executive          :326   1:289           Divorced:327   0:   0   0:1054  
 Male  :882   2:375          Research Scientist       :292   2:280           Married :673   1:1470   1: 416  
              3:868          Laboratory Technician    :259   3:442           Single  :470                    
              4:144          Manufacturing Director   :145   4:459                                           
                             Healthcare Representative:131                                                   
                             Manager                  :102                                                   
                             (Other)                  :215                                                   
 PerformanceRating RelationshipSatisfaction StockOptionLevel WorkLifeBalance
 1:   0            1:276                    0:631            1: 80          
 2:   0            2:303                    1:596            2:344          
 3:1244            3:459                    2:158            3:893          
 4: 226            4:432                    3: 85            4:153          
                                                                            
                                                                            
                                                                            

Plot our Data

ggplot(data=data, aes(Attrition)) + geom_histogram(stat="count") + labs(x="Attrition")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(Age)) + geom_histogram(binwidth=5) + labs(x="Age")

ggplot(data=data, aes(BusinessTravel)) + geom_histogram(stat="count") + labs(x="Business Travel")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(DailyRate)) + geom_histogram(binwidth=15) + labs(x="Daily Rate")

ggplot(data=data, aes(Department)) + geom_histogram(stat="count") + labs(x="Department")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(DistanceFromHome)) + geom_histogram(binwidth=5) + labs(x="Distance from Home")

ggplot(data=data, aes(Education)) + geom_histogram(stat="count") + labs(x="Education")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(EducationField)) + geom_histogram(stat="count") + labs(x="Education Field")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(EmployeeCount)) + geom_histogram(binwidth=1) + labs(x="Employee Count")

ggplot(data=data, aes(EmployeeNumber)) + geom_histogram(binwidth=20) + labs(x="Employee Number")

ggplot(data=data, aes(EnvironmentSatisfaction)) + geom_histogram(stat="count") + labs(x="Environment Satisfaction")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(Gender)) + geom_histogram(stat="count") + labs(x="Gender")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(HourlyRate)) + geom_histogram(binwidth=5) + labs(x="Hourly Rate")

ggplot(data=data, aes(JobInvolvement)) + geom_histogram(stat="count") + labs(x="Job Involvement")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(JobLevel)) + geom_histogram(stat="count") + labs(x="Job Level")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(JobRole)) + geom_histogram(stat="count") + labs(x="Job Role")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(JobSatisfaction)) + geom_histogram(stat="count") + labs(x="Job Satisfaction")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(MaritalStatus)) + geom_histogram(stat="count") + labs(x="Marital Status")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(MonthlyIncome)) + geom_histogram(binwidth=50) + labs(x="Monthly Income")

ggplot(data=data, aes(MonthlyRate)) + geom_histogram(binwidth=50) + labs(x="Monthly Rate")

ggplot(data=data, aes(NumCompaniesWorked)) + geom_histogram(binwidth=1) + labs(x="Num Companies Worked")

ggplot(data=data, aes(Over18)) + geom_histogram(stat="count") + labs(x="Over 18")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(PercentSalaryHike)) + geom_histogram(binwidth=5) + labs(x="Percent Salary Hike")

ggplot(data=data, aes(PerformanceRating)) + geom_histogram(stat="count") + labs(x="Performance Rating")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(RelationshipSatisfaction)) + geom_histogram(stat="count") + labs(x="Relationship Satisfaction")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(StandardHours)) + geom_histogram(binwidth=5) + labs(x="Standard Hours")

ggplot(data=data, aes(StockOptionLevel)) + geom_histogram(stat="count") + labs(x="Stock Option Level")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(TotalWorkingYears)) + geom_histogram(binwidth=5) + labs(x="Total Working Years")

ggplot(data=data, aes(TrainingTimesLastYear)) + geom_histogram(binwidth=5) + labs(x="Training Times Last Year")

ggplot(data=data, aes(WorkLifeBalance)) + geom_histogram(stat="count") + labs(x="Work Life Balance")
Ignoring unknown parameters: binwidth, bins, pad

ggplot(data=data, aes(YearsAtCompany)) + geom_histogram(binwidth=2) + labs(x="Years At Company")

ggplot(data=data, aes(YearsSinceLastPromotion)) + geom_histogram(binwidth=2) + labs(x="Years Since Last Promotion")

ggplot(data=data, aes(YearsWithCurrManager)) + geom_histogram(binwidth=2) + labs(x="Years With Curr Manager")


#######################################
##  BUILD OUR LOGISTIC MODEL - logmod
#######################################

# xtabs(~Attrition + Age, data=data)
xtabs(~Attrition + BusinessTravel, data=data)
         BusinessTravel
Attrition Non-Travel Travel_Frequently Travel_Rarely
        0        138               208           887
        1         12                69           156
# xtabs(~Attrition + DailyRate, data=data)
xtabs(~Attrition + factor(Department), data=data)
         factor(Department)
Attrition Human Resources Research & Development Sales
        0              51                    828   354
        1              12                    133    92
# xtabs(~Attrition + DistanceFromHome, data=data)
xtabs(~Attrition + factor(Education), data=data)
         factor(Education)
Attrition   1   2   3   4   5
        0 139 238 473 340  43
        1  31  44  99  58   5
xtabs(~Attrition + EducationField, data=data)
         EducationField
Attrition Human Resources Life Sciences Marketing Medical Other Technical Degree
        0              20           517       124     401    71              100
        1               7            89        35      63    11               32
xtabs(~Attrition + EmployeeCount, data=data)
         EmployeeCount
Attrition    1
        0 1233
        1  237
# xtabs(~Attrition + EmployeeNumber, data=data)
xtabs(~Attrition + factor(EnvironmentSatisfaction), data=data)
         factor(EnvironmentSatisfaction)
Attrition   1   2   3   4
        0 212 244 391 386
        1  72  43  62  60
xtabs(~Attrition + factor(Gender), data=data)
         factor(Gender)
Attrition Female Male
        0    501  732
        1     87  150
# xtabs(~Attrition + HourlyRate, data=data)
xtabs(~Attrition + factor(JobInvolvement), data=data)
         factor(JobInvolvement)
Attrition   1   2   3   4
        0  55 304 743 131
        1  28  71 125  13
xtabs(~Attrition + factor(JobLevel), data=data)
         factor(JobLevel)
Attrition   1   2   3   4   5
        0 400 482 186 101  64
        1 143  52  32   5   5
xtabs(~Attrition + factor(JobRole), data=data)
         factor(JobRole)
Attrition Healthcare Representative Human Resources Laboratory Technician Manager Manufacturing Director Research Director
        0                       122              40                   197      97                    135                78
        1                         9              12                    62       5                     10                 2
         factor(JobRole)
Attrition Research Scientist Sales Executive Sales Representative
        0                245             269                   50
        1                 47              57                   33
xtabs(~Attrition + factor(JobSatisfaction), data=data)
         factor(JobSatisfaction)
Attrition   1   2   3   4
        0 223 234 369 407
        1  66  46  73  52
xtabs(~Attrition + factor(MaritalStatus), data=data)
         factor(MaritalStatus)
Attrition Divorced Married Single
        0      294     589    350
        1       33      84    120
# xtabs(~Attrition + MonthlyIncome, data=data)
# xtabs(~Attrition + MonthlyRate, data=data)
xtabs(~Attrition + NumCompaniesWorked, data=data)
         NumCompaniesWorked
Attrition   0   1   2   3   4   5   6   7   8   9
        0 174 423 130 143 122  47  54  57  43  40
        1  23  98  16  16  17  16  16  17   6  12
xtabs(~Attrition + factor(OverTime), data=data)
         factor(OverTime)
Attrition   0   1
        0 944 289
        1 110 127
# xtabs(~Attrition + PercentSalaryHike, data=data)
xtabs(~Attrition + factor(PerformanceRating), data=data)
         factor(PerformanceRating)
Attrition    3    4
        0 1044  189
        1  200   37
xtabs(~Attrition + factor(RelationshipSatisfaction), data=data)
         factor(RelationshipSatisfaction)
Attrition   1   2   3   4
        0 219 258 388 368
        1  57  45  71  64
xtabs(~Attrition + StandardHours, data=data)
         StandardHours
Attrition   80
        0 1233
        1  237
xtabs(~Attrition + factor(StockOptionLevel), data=data)
         factor(StockOptionLevel)
Attrition   0   1   2   3
        0 477 540 146  70
        1 154  56  12  15
# xtabs(~Attrition + TotalWorkingYears, data=data)
xtabs(~Attrition + TrainingTimesLastYear, data=data)
         TrainingTimesLastYear
Attrition   0   1   2   3   4   5   6
        0  39  62 449 422  97 105  59
        1  15   9  98  69  26  14   6
xtabs(~Attrition + factor(WorkLifeBalance), data=data)
         factor(WorkLifeBalance)
Attrition   1   2   3   4
        0  55 286 766 126
        1  25  58 127  27
# xtabs(~Attrition + YearsAtCompany, data=data)
# xtabs(~Attrition + YearsSinceLastPromotion, data=data)
# xtabs(~Attrition + YearsWithCurrManager, data=data)

Compensating for Unbalanced Data

When we plot the histogram of Attrition, we immediate observe an unbalanced dataset where the minority value is 1 corresponding to employees leaving an organization.

data<-original.data
ggplot(data=data, aes(Attrition)) + geom_histogram(stat="count") + labs(x="Attrition")
Ignoring unknown parameters: binwidth, bins, pad

To compensate for this, we use a technique called over/undersampling using the ROSE library which results on a balanced dataset.

#balancing data:
#what to do if number of 1's is much smaller than the number of 0's
#find the indeces corresponding to 0s, and 1's
input_ones <- data[which(data$Attrition == 1), ]  # all 1's
input_zeros <- data[which(data$Attrition == 0), ]  # all 0's

#reduce the number of 0's by selecting a sample at random of the size of the 1's you have. 
#you can have a different proportion. I made it 50:50 but use your judgement. 
#Perhaps you want 1:2 ratio to include more cases.
#set.seed(100)  # for repeatability of samples
#which.zeros<- sample(1:nrow(input_zeros), nrow(input_ones))
#sample.from.zeros<-input_zeros[which.zeros,]
#put the data together:
#balanced.data<-rbind(input_ones,sample.from.zeros)

#Altenatively, you can leave the zeros as they are and resample the 1's
#set.seed(100)  # for repeatability of samples
#which.ones<- sample(1:2*nrow(input_ones), nrow(input_zeros),replace=TRUE)
#resample.ones<-input_ones[which.ones,]
#balanced.data<-rbind(resample.ones,input_zeros)

#another way: sake a sample of the same zise for both (p=.5), total samples=3000
#  "both" oversamples minority(1's) and undersamples mayority(0's)
library(ROSE)
balanced.data<-ovun.sample(Attrition~.,data=data,method="both",p=0.5,N=3000,seed=1)$data
#####################################
##
## Now we will use all of the data available to predict attrition
##
#####################################
data<-balanced.data

logmod <- glm(
  factor(Attrition) ~ 
    Age
  + factor(BusinessTravel) * DistanceFromHome * factor(MaritalStatus) * factor(WorkLifeBalance)
  + DailyRate
  + factor(Department)
  + factor(Education) * EducationField
  + factor(JobInvolvement) * factor(JobLevel) * factor(JobSatisfaction)
  + factor(EnvironmentSatisfaction) * factor(Gender) * factor(JobRole)
  + MonthlyIncome * HourlyRate * factor(OverTime)
  + NumCompaniesWorked
  + factor(PerformanceRating)
  + factor(RelationshipSatisfaction)
  + factor(StockOptionLevel) * TotalWorkingYears * TrainingTimesLastYear
  + PercentSalaryHike * YearsAtCompany * YearsSinceLastPromotion * YearsWithCurrManager
  , data=data
  , family=binomial
)
glm.fit: fitted probabilities numerically 0 or 1 occurred
summary(logmod)

Call:
glm(formula = factor(Attrition) ~ Age + factor(BusinessTravel) * 
    DistanceFromHome * factor(MaritalStatus) * factor(WorkLifeBalance) + 
    DailyRate + factor(Department) + factor(Education) * EducationField + 
    factor(JobInvolvement) * factor(JobLevel) * factor(JobSatisfaction) + 
    factor(EnvironmentSatisfaction) * factor(Gender) * factor(JobRole) + 
    MonthlyIncome * HourlyRate * factor(OverTime) + NumCompaniesWorked + 
    factor(PerformanceRating) + factor(RelationshipSatisfaction) + 
    factor(StockOptionLevel) * TotalWorkingYears * TrainingTimesLastYear + 
    PercentSalaryHike * YearsAtCompany * YearsSinceLastPromotion * 
        YearsWithCurrManager, family = binomial, data = data)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-4.2992  -0.0216   0.0000   0.1645   4.6607  

Coefficients: (6 not defined because of singularities)
                                                                                                                  Estimate
(Intercept)                                                                                                     -1.535e+00
Age                                                                                                             -7.520e-02
factor(BusinessTravel)Travel_Frequently                                                                         -4.180e+01
factor(BusinessTravel)Travel_Rarely                                                                             -4.928e+01
DistanceFromHome                                                                                                -5.956e+00
factor(MaritalStatus)Married                                                                                    -1.359e+02
factor(MaritalStatus)Single                                                                                     -3.879e+02
factor(WorkLifeBalance).L                                                                                        2.070e+01
factor(WorkLifeBalance).Q                                                                                        1.130e+02
factor(WorkLifeBalance).C                                                                                        4.535e+00
DailyRate                                                                                                       -1.039e-03
factor(Department)Research & Development                                                                         3.291e+01
factor(Department)Sales                                                                                         -2.953e+01
factor(Education).L                                                                                              1.204e+01
factor(Education).Q                                                                                              3.154e+00
factor(Education).C                                                                                             -3.673e+01
factor(Education)^4                                                                                              5.191e+00
EducationFieldLife Sciences                                                                                     -8.754e+00
EducationFieldMarketing                                                                                         -2.985e+00
EducationFieldMedical                                                                                           -7.635e+00
EducationFieldOther                                                                                             -8.790e+00
EducationFieldTechnical Degree                                                                                  -1.937e+00
factor(JobInvolvement).L                                                                                        -1.478e+01
factor(JobInvolvement).Q                                                                                         2.059e+00
factor(JobInvolvement).C                                                                                        -5.251e+00
factor(JobLevel)2                                                                                               -5.840e+00
factor(JobLevel)3                                                                                               -1.257e+01
factor(JobLevel)4                                                                                                3.089e+01
factor(JobLevel)5                                                                                                4.207e+01
factor(JobSatisfaction).L                                                                                       -1.002e+01
factor(JobSatisfaction).Q                                                                                       -1.355e+00
factor(JobSatisfaction).C                                                                                        2.254e-01
factor(EnvironmentSatisfaction).L                                                                                2.702e+00
factor(EnvironmentSatisfaction).Q                                                                                2.352e+01
factor(EnvironmentSatisfaction).C                                                                               -1.802e+01
factor(Gender)Male                                                                                              -5.997e+00
factor(JobRole)Human Resources                                                                                   4.545e+01
factor(JobRole)Laboratory Technician                                                                             9.171e+00
factor(JobRole)Manager                                                                                          -3.780e+01
factor(JobRole)Manufacturing Director                                                                           -1.339e+01
factor(JobRole)Research Director                                                                                -2.024e+01
factor(JobRole)Research Scientist                                                                                6.663e+00
factor(JobRole)Sales Executive                                                                                   7.146e+01
factor(JobRole)Sales Representative                                                                              7.792e+01
MonthlyIncome                                                                                                   -5.959e-04
HourlyRate                                                                                                      -1.282e-02
factor(OverTime)1                                                                                               -2.701e-01
NumCompaniesWorked                                                                                               4.517e-01
factor(PerformanceRating).L                                                                                     -7.197e-01
factor(RelationshipSatisfaction).L                                                                              -2.327e+00
factor(RelationshipSatisfaction).Q                                                                               8.479e-01
factor(RelationshipSatisfaction).C                                                                              -4.318e-01
factor(StockOptionLevel).L                                                                                       7.115e-01
factor(StockOptionLevel).Q                                                                                       7.312e-01
factor(StockOptionLevel).C                                                                                      -4.657e+00
TotalWorkingYears                                                                                               -3.316e-01
TrainingTimesLastYear                                                                                           -1.303e+00
PercentSalaryHike                                                                                                1.781e-01
YearsAtCompany                                                                                                   6.439e-01
YearsSinceLastPromotion                                                                                         -6.079e-01
YearsWithCurrManager                                                                                            -2.468e+00
factor(BusinessTravel)Travel_Frequently:DistanceFromHome                                                         6.475e+00
factor(BusinessTravel)Travel_Rarely:DistanceFromHome                                                             7.487e+00
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married                                             1.544e+02
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married                                                 1.520e+02
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Single                                              3.990e+02
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Single                                                  4.053e+02
DistanceFromHome:factor(MaritalStatus)Married                                                                    1.103e+01
DistanceFromHome:factor(MaritalStatus)Single                                                                     3.673e+01
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).L                                               -2.801e+01
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).L                                                    2.687e+01
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).Q                                               -1.380e+02
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).Q                                                   -1.368e+02
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).C                                               -2.084e+00
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).C                                                    9.587e+00
DistanceFromHome:factor(WorkLifeBalance).L                                                                      -2.305e+00
DistanceFromHome:factor(WorkLifeBalance).Q                                                                      -1.152e+01
DistanceFromHome:factor(WorkLifeBalance).C                                                                      -2.275e-02
factor(MaritalStatus)Married:factor(WorkLifeBalance).L                                                           6.706e+01
factor(MaritalStatus)Single:factor(WorkLifeBalance).L                                                            7.344e+02
factor(MaritalStatus)Married:factor(WorkLifeBalance).Q                                                           3.794e+01
factor(MaritalStatus)Single:factor(WorkLifeBalance).Q                                                           -5.253e+02
factor(MaritalStatus)Married:factor(WorkLifeBalance).C                                                          -2.398e+02
factor(MaritalStatus)Single:factor(WorkLifeBalance).C                                                            3.566e+01
factor(Education).L:EducationFieldLife Sciences                                                                 -2.240e+01
factor(Education).Q:EducationFieldLife Sciences                                                                 -1.529e+01
factor(Education).C:EducationFieldLife Sciences                                                                  3.153e+01
factor(Education)^4:EducationFieldLife Sciences                                                                 -8.096e+00
factor(Education).L:EducationFieldMarketing                                                                     -1.366e+01
factor(Education).Q:EducationFieldMarketing                                                                     -3.780e+00
factor(Education).C:EducationFieldMarketing                                                                      3.758e+01
factor(Education)^4:EducationFieldMarketing                                                                     -4.943e+00
factor(Education).L:EducationFieldMedical                                                                       -2.542e+01
factor(Education).Q:EducationFieldMedical                                                                       -1.424e+01
factor(Education).C:EducationFieldMedical                                                                        3.178e+01
factor(Education)^4:EducationFieldMedical                                                                       -9.096e+00
factor(Education).L:EducationFieldOther                                                                         -1.996e+01
factor(Education).Q:EducationFieldOther                                                                         -1.265e+01
factor(Education).C:EducationFieldOther                                                                          2.895e+01
factor(Education)^4:EducationFieldOther                                                                         -7.194e+00
factor(Education).L:EducationFieldTechnical Degree                                                              -5.854e+00
factor(Education).Q:EducationFieldTechnical Degree                                                              -9.808e-01
factor(Education).C:EducationFieldTechnical Degree                                                               3.912e+01
factor(Education)^4:EducationFieldTechnical Degree                                                              -1.405e+00
factor(JobInvolvement).L:factor(JobLevel)2                                                                       1.905e+00
factor(JobInvolvement).Q:factor(JobLevel)2                                                                      -8.234e+00
factor(JobInvolvement).C:factor(JobLevel)2                                                                       9.556e-01
factor(JobInvolvement).L:factor(JobLevel)3                                                                       3.320e+01
factor(JobInvolvement).Q:factor(JobLevel)3                                                                      -2.303e+01
factor(JobInvolvement).C:factor(JobLevel)3                                                                       7.732e+00
factor(JobInvolvement).L:factor(JobLevel)4                                                                      -1.222e+02
factor(JobInvolvement).Q:factor(JobLevel)4                                                                       8.435e+01
factor(JobInvolvement).C:factor(JobLevel)4                                                                      -4.981e+01
factor(JobInvolvement).L:factor(JobLevel)5                                                                      -4.489e+01
factor(JobInvolvement).Q:factor(JobLevel)5                                                                       4.742e+01
factor(JobInvolvement).C:factor(JobLevel)5                                                                       9.177e+00
factor(JobInvolvement).L:factor(JobSatisfaction).L                                                               2.917e+00
factor(JobInvolvement).Q:factor(JobSatisfaction).L                                                              -1.720e+01
factor(JobInvolvement).C:factor(JobSatisfaction).L                                                               4.372e+00
factor(JobInvolvement).L:factor(JobSatisfaction).Q                                                              -1.067e+01
factor(JobInvolvement).Q:factor(JobSatisfaction).Q                                                              -4.142e+00
factor(JobInvolvement).C:factor(JobSatisfaction).Q                                                              -2.620e+00
factor(JobInvolvement).L:factor(JobSatisfaction).C                                                              -8.234e+00
factor(JobInvolvement).Q:factor(JobSatisfaction).C                                                               3.467e+00
factor(JobInvolvement).C:factor(JobSatisfaction).C                                                              -2.045e+00
factor(JobLevel)2:factor(JobSatisfaction).L                                                                      8.128e+00
factor(JobLevel)3:factor(JobSatisfaction).L                                                                      2.422e+01
factor(JobLevel)4:factor(JobSatisfaction).L                                                                     -1.605e+01
factor(JobLevel)5:factor(JobSatisfaction).L                                                                     -5.998e+01
factor(JobLevel)2:factor(JobSatisfaction).Q                                                                     -3.798e+00
factor(JobLevel)3:factor(JobSatisfaction).Q                                                                      1.492e+01
factor(JobLevel)4:factor(JobSatisfaction).Q                                                                      6.708e+01
factor(JobLevel)5:factor(JobSatisfaction).Q                                                                      2.263e+01
factor(JobLevel)2:factor(JobSatisfaction).C                                                                     -4.324e+00
factor(JobLevel)3:factor(JobSatisfaction).C                                                                      5.987e+00
factor(JobLevel)4:factor(JobSatisfaction).C                                                                     -2.129e+01
factor(JobLevel)5:factor(JobSatisfaction).C                                                                      3.669e+01
factor(EnvironmentSatisfaction).L:factor(Gender)Male                                                            -2.355e+01
factor(EnvironmentSatisfaction).Q:factor(Gender)Male                                                            -2.093e+01
factor(EnvironmentSatisfaction).C:factor(Gender)Male                                                             3.403e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Human Resources                                                -1.099e+01
factor(EnvironmentSatisfaction).Q:factor(JobRole)Human Resources                                                -2.646e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Human Resources                                                 2.975e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Laboratory Technician                                          -5.865e+00
factor(EnvironmentSatisfaction).Q:factor(JobRole)Laboratory Technician                                          -2.485e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Laboratory Technician                                           1.883e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Manager                                                         1.281e+01
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manager                                                        -2.689e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Manager                                                         2.203e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Manufacturing Director                                         -1.485e+01
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manufacturing Director                                         -6.357e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Manufacturing Director                                          1.689e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Director                                              -2.918e+01
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Director                                              -4.001e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Director                                               1.008e+02
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Scientist                                             -5.404e+00
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Scientist                                             -1.895e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Scientist                                              1.364e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Executive                                                -4.536e+00
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Executive                                                -2.093e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Executive                                                 1.876e+01
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Representative                                           -1.972e+01
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Representative                                           -1.461e+01
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Representative                                            1.326e+01
factor(Gender)Male:factor(JobRole)Human Resources                                                               -4.406e+00
factor(Gender)Male:factor(JobRole)Laboratory Technician                                                          8.017e+00
factor(Gender)Male:factor(JobRole)Manager                                                                        3.934e+01
factor(Gender)Male:factor(JobRole)Manufacturing Director                                                         2.813e+01
factor(Gender)Male:factor(JobRole)Research Director                                                             -4.012e+01
factor(Gender)Male:factor(JobRole)Research Scientist                                                             7.909e+00
factor(Gender)Male:factor(JobRole)Sales Executive                                                                7.983e+00
factor(Gender)Male:factor(JobRole)Sales Representative                                                           2.415e+00
MonthlyIncome:HourlyRate                                                                                         1.255e-05
MonthlyIncome:factor(OverTime)1                                                                                  1.487e-03
HourlyRate:factor(OverTime)1                                                                                     1.169e-01
factor(StockOptionLevel).L:TotalWorkingYears                                                                     3.423e-01
factor(StockOptionLevel).Q:TotalWorkingYears                                                                     8.717e-01
factor(StockOptionLevel).C:TotalWorkingYears                                                                     7.281e-01
factor(StockOptionLevel).L:TrainingTimesLastYear                                                                -1.498e+00
factor(StockOptionLevel).Q:TrainingTimesLastYear                                                                 8.355e-01
factor(StockOptionLevel).C:TrainingTimesLastYear                                                                 1.420e+00
TotalWorkingYears:TrainingTimesLastYear                                                                          2.876e-02
PercentSalaryHike:YearsAtCompany                                                                                -2.883e-02
PercentSalaryHike:YearsSinceLastPromotion                                                                       -3.987e-02
YearsAtCompany:YearsSinceLastPromotion                                                                           7.735e-02
PercentSalaryHike:YearsWithCurrManager                                                                           1.015e-01
YearsAtCompany:YearsWithCurrManager                                                                              6.455e-02
YearsSinceLastPromotion:YearsWithCurrManager                                                                     3.746e-01
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Married                           -1.329e+01
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Married                               -1.250e+01
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Single                            -3.682e+01
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Single                                -3.818e+01
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).L                               1.551e+00
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).L                                  -2.551e+00
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).Q                               1.271e+01
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).Q                                   1.429e+01
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).C                              -4.503e-01
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).C                                  -1.379e+00
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married:factor(WorkLifeBalance).L                  -8.620e+01
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married:factor(WorkLifeBalance).L                      -1.140e+02
                                                                                                                Std. Error
(Intercept)                                                                                                      7.278e+04
Age                                                                                                              1.875e-02
factor(BusinessTravel)Travel_Frequently                                                                          7.302e+04
factor(BusinessTravel)Travel_Rarely                                                                              7.218e+04
DistanceFromHome                                                                                                 9.188e+03
factor(MaritalStatus)Married                                                                                     7.389e+04
factor(MaritalStatus)Single                                                                                      1.960e+05
factor(WorkLifeBalance).L                                                                                        1.917e+05
factor(WorkLifeBalance).Q                                                                                        1.437e+05
factor(WorkLifeBalance).C                                                                                        6.756e+04
DailyRate                                                                                                        3.491e-04
factor(Department)Research & Development                                                                         1.057e+04
factor(Department)Sales                                                                                          1.084e+04
factor(Education).L                                                                                              7.332e+03
factor(Education).Q                                                                                              6.196e+03
factor(Education).C                                                                                              1.466e+04
factor(Education)^4                                                                                              1.108e+04
EducationFieldLife Sciences                                                                                      4.875e+03
EducationFieldMarketing                                                                                          4.637e+03
EducationFieldMedical                                                                                            4.844e+03
EducationFieldOther                                                                                              8.244e+03
EducationFieldTechnical Degree                                                                                   4.637e+03
factor(JobInvolvement).L                                                                                         2.693e+03
factor(JobInvolvement).Q                                                                                         2.007e+03
factor(JobInvolvement).C                                                                                         8.977e+02
factor(JobLevel)2                                                                                                1.358e+03
factor(JobLevel)3                                                                                                4.612e+03
factor(JobLevel)4                                                                                                2.315e+04
factor(JobLevel)5                                                                                                2.067e+04
factor(JobSatisfaction).L                                                                                        1.959e+03
factor(JobSatisfaction).Q                                                                                        2.007e+03
factor(JobSatisfaction).C                                                                                        2.054e+03
factor(EnvironmentSatisfaction).L                                                                                2.252e+03
factor(EnvironmentSatisfaction).Q                                                                                5.036e+03
factor(EnvironmentSatisfaction).C                                                                                6.757e+03
factor(Gender)Male                                                                                               3.218e+03
factor(JobRole)Human Resources                                                                                   1.124e+04
factor(JobRole)Laboratory Technician                                                                             2.518e+03
factor(JobRole)Manager                                                                                           4.660e+03
factor(JobRole)Manufacturing Director                                                                            4.202e+03
factor(JobRole)Research Director                                                                                 5.641e+03
factor(JobRole)Research Scientist                                                                                2.518e+03
factor(JobRole)Sales Executive                                                                                   4.711e+03
factor(JobRole)Sales Representative                                                                              5.760e+03
MonthlyIncome                                                                                                    2.768e-04
HourlyRate                                                                                                       1.736e-02
factor(OverTime)1                                                                                                1.931e+00
NumCompaniesWorked                                                                                               6.664e-02
factor(PerformanceRating).L                                                                                      4.410e-01
factor(RelationshipSatisfaction).L                                                                               3.001e-01
factor(RelationshipSatisfaction).Q                                                                               2.949e-01
factor(RelationshipSatisfaction).C                                                                               2.935e-01
factor(StockOptionLevel).L                                                                                       3.029e+00
factor(StockOptionLevel).Q                                                                                       2.906e+00
factor(StockOptionLevel).C                                                                                       2.648e+00
TotalWorkingYears                                                                                                1.452e-01
TrainingTimesLastYear                                                                                            4.801e-01
PercentSalaryHike                                                                                                9.609e-02
YearsAtCompany                                                                                                   4.125e-01
YearsSinceLastPromotion                                                                                          1.262e+00
YearsWithCurrManager                                                                                             6.778e-01
factor(BusinessTravel)Travel_Frequently:DistanceFromHome                                                         9.250e+03
factor(BusinessTravel)Travel_Rarely:DistanceFromHome                                                             9.209e+03
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married                                             7.516e+04
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married                                                 7.421e+04
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Single                                              1.964e+05
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Single                                                  1.958e+05
DistanceFromHome:factor(MaritalStatus)Married                                                                    9.517e+03
DistanceFromHome:factor(MaritalStatus)Single                                                                     1.754e+04
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).L                                                1.948e+05
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).L                                                    1.925e+05
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).Q                                                1.460e+05
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).Q                                                    1.444e+05
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).C                                                6.856e+04
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).C                                                    6.783e+04
DistanceFromHome:factor(WorkLifeBalance).L                                                                       2.454e+04
DistanceFromHome:factor(WorkLifeBalance).Q                                                                       1.838e+04
DistanceFromHome:factor(WorkLifeBalance).C                                                                       8.566e+03
factor(MaritalStatus)Married:factor(WorkLifeBalance).L                                                           1.966e+05
factor(MaritalStatus)Single:factor(WorkLifeBalance).L                                                            2.065e+05
factor(MaritalStatus)Married:factor(WorkLifeBalance).Q                                                           1.478e+05
factor(MaritalStatus)Single:factor(WorkLifeBalance).Q                                                            3.959e+05
factor(MaritalStatus)Married:factor(WorkLifeBalance).C                                                           7.078e+04
factor(MaritalStatus)Single:factor(WorkLifeBalance).C                                                            5.823e+04
factor(Education).L:EducationFieldLife Sciences                                                                  8.739e+03
factor(Education).Q:EducationFieldLife Sciences                                                                  7.386e+03
factor(Education).C:EducationFieldLife Sciences                                                                  1.485e+04
factor(Education)^4:EducationFieldLife Sciences                                                                  1.112e+04
factor(Education).L:EducationFieldMarketing                                                                      7.332e+03
factor(Education).Q:EducationFieldMarketing                                                                      6.196e+03
factor(Education).C:EducationFieldMarketing                                                                      1.466e+04
factor(Education)^4:EducationFieldMarketing                                                                      1.108e+04
factor(Education).L:EducationFieldMedical                                                                        8.569e+03
factor(Education).Q:EducationFieldMedical                                                                        7.242e+03
factor(Education).C:EducationFieldMedical                                                                        1.483e+04
factor(Education)^4:EducationFieldMedical                                                                        1.112e+04
factor(Education).L:EducationFieldOther                                                                          2.277e+04
factor(Education).Q:EducationFieldOther                                                                          1.924e+04
factor(Education).C:EducationFieldOther                                                                          1.820e+04
factor(Education)^4:EducationFieldOther                                                                          1.181e+04
factor(Education).L:EducationFieldTechnical Degree                                                               7.332e+03
factor(Education).Q:EducationFieldTechnical Degree                                                               6.196e+03
factor(Education).C:EducationFieldTechnical Degree                                                               1.466e+04
factor(Education)^4:EducationFieldTechnical Degree                                                               1.108e+04
factor(JobInvolvement).L:factor(JobLevel)2                                                                       3.643e+03
factor(JobInvolvement).Q:factor(JobLevel)2                                                                       2.715e+03
factor(JobInvolvement).C:factor(JobLevel)2                                                                       1.214e+03
factor(JobInvolvement).L:factor(JobLevel)3                                                                       9.497e+03
factor(JobInvolvement).Q:factor(JobLevel)3                                                                       8.371e+03
factor(JobInvolvement).C:factor(JobLevel)3                                                                       2.691e+03
factor(JobInvolvement).L:factor(JobLevel)4                                                                       1.010e+05
factor(JobInvolvement).Q:factor(JobLevel)4                                                                       4.553e+04
factor(JobInvolvement).C:factor(JobLevel)4                                                                       3.383e+04
factor(JobInvolvement).L:factor(JobLevel)5                                                                       6.079e+04
factor(JobInvolvement).Q:factor(JobLevel)5                                                                       4.909e+04
factor(JobInvolvement).C:factor(JobLevel)5                                                                       2.648e+04
factor(JobInvolvement).L:factor(JobSatisfaction).L                                                               5.258e+03
factor(JobInvolvement).Q:factor(JobSatisfaction).L                                                               3.919e+03
factor(JobInvolvement).C:factor(JobSatisfaction).L                                                               1.753e+03
factor(JobInvolvement).L:factor(JobSatisfaction).Q                                                               5.386e+03
factor(JobInvolvement).Q:factor(JobSatisfaction).Q                                                               4.015e+03
factor(JobInvolvement).C:factor(JobSatisfaction).Q                                                               1.795e+03
factor(JobInvolvement).L:factor(JobSatisfaction).C                                                               5.512e+03
factor(JobInvolvement).Q:factor(JobSatisfaction).C                                                               4.109e+03
factor(JobInvolvement).C:factor(JobSatisfaction).C                                                               1.837e+03
factor(JobLevel)2:factor(JobSatisfaction).L                                                                      2.567e+03
factor(JobLevel)3:factor(JobSatisfaction).L                                                                      6.777e+03
factor(JobLevel)4:factor(JobSatisfaction).L                                                                      7.208e+04
factor(JobLevel)5:factor(JobSatisfaction).L                                                                      7.234e+04
factor(JobLevel)2:factor(JobSatisfaction).Q                                                                      2.715e+03
factor(JobLevel)3:factor(JobSatisfaction).Q                                                                      8.262e+03
factor(JobLevel)4:factor(JobSatisfaction).Q                                                                      7.454e+04
factor(JobLevel)5:factor(JobSatisfaction).Q                                                                      6.577e+04
factor(JobLevel)2:factor(JobSatisfaction).C                                                                      2.856e+03
factor(JobLevel)3:factor(JobSatisfaction).C                                                                      1.106e+04
factor(JobLevel)4:factor(JobSatisfaction).C                                                                      4.768e+04
factor(JobLevel)5:factor(JobSatisfaction).C                                                                      1.756e+04
factor(EnvironmentSatisfaction).L:factor(Gender)Male                                                             4.855e+03
factor(EnvironmentSatisfaction).Q:factor(Gender)Male                                                             6.436e+03
factor(EnvironmentSatisfaction).C:factor(Gender)Male                                                             7.699e+03
factor(EnvironmentSatisfaction).L:factor(JobRole)Human Resources                                                 3.419e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Human Resources                                                 7.646e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Human Resources                                                 1.026e+04
factor(EnvironmentSatisfaction).L:factor(JobRole)Laboratory Technician                                           2.252e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Laboratory Technician                                           5.036e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Laboratory Technician                                           6.757e+03
factor(EnvironmentSatisfaction).L:factor(JobRole)Manager                                                         6.279e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manager                                                         8.845e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Manager                                                         1.082e+04
factor(EnvironmentSatisfaction).L:factor(JobRole)Manufacturing Director                                          9.304e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manufacturing Director                                          8.405e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Manufacturing Director                                          7.397e+03
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Director                                               8.667e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Director                                               1.109e+04
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Director                                               1.323e+04
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Scientist                                              2.252e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Scientist                                              5.036e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Scientist                                              6.757e+03
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Executive                                                 2.252e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Executive                                                 5.036e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Executive                                                 6.757e+03
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Representative                                            9.175e+03
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Representative                                            8.325e+03
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Representative                                            7.379e+03
factor(Gender)Male:factor(JobRole)Human Resources                                                                4.629e+03
factor(Gender)Male:factor(JobRole)Laboratory Technician                                                          3.218e+03
factor(Gender)Male:factor(JobRole)Manager                                                                        5.084e+03
factor(Gender)Male:factor(JobRole)Manufacturing Director                                                         4.656e+03
factor(Gender)Male:factor(JobRole)Research Director                                                              8.916e+03
factor(Gender)Male:factor(JobRole)Research Scientist                                                             3.218e+03
factor(Gender)Male:factor(JobRole)Sales Executive                                                                3.218e+03
factor(Gender)Male:factor(JobRole)Sales Representative                                                           4.620e+03
MonthlyIncome:HourlyRate                                                                                         3.738e-06
MonthlyIncome:factor(OverTime)1                                                                                  4.070e-04
HourlyRate:factor(OverTime)1                                                                                     3.008e-02
factor(StockOptionLevel).L:TotalWorkingYears                                                                     3.003e-01
factor(StockOptionLevel).Q:TotalWorkingYears                                                                     3.000e-01
factor(StockOptionLevel).C:TotalWorkingYears                                                                     2.735e-01
factor(StockOptionLevel).L:TrainingTimesLastYear                                                                 1.076e+00
factor(StockOptionLevel).Q:TrainingTimesLastYear                                                                 9.678e-01
factor(StockOptionLevel).C:TrainingTimesLastYear                                                                 8.183e-01
TotalWorkingYears:TrainingTimesLastYear                                                                          4.802e-02
PercentSalaryHike:YearsAtCompany                                                                                 2.637e-02
PercentSalaryHike:YearsSinceLastPromotion                                                                        8.424e-02
YearsAtCompany:YearsSinceLastPromotion                                                                           1.101e-01
PercentSalaryHike:YearsWithCurrManager                                                                           4.168e-02
YearsAtCompany:YearsWithCurrManager                                                                              6.229e-02
YearsSinceLastPromotion:YearsWithCurrManager                                                                     2.002e-01
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Married                            9.616e+03
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Married                                9.537e+03
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Single                             1.758e+04
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Single                                 1.753e+04
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).L                               2.470e+04
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).L                                   2.459e+04
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).Q                               1.850e+04
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).Q                                   1.842e+04
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).C                               8.619e+03
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).C                                   8.584e+03
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married:factor(WorkLifeBalance).L                   2.001e+05
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married:factor(WorkLifeBalance).L                       1.975e+05
                                                                                                                z value
(Intercept)                                                                                                       0.000
Age                                                                                                              -4.010
factor(BusinessTravel)Travel_Frequently                                                                          -0.001
factor(BusinessTravel)Travel_Rarely                                                                              -0.001
DistanceFromHome                                                                                                 -0.001
factor(MaritalStatus)Married                                                                                     -0.002
factor(MaritalStatus)Single                                                                                      -0.002
factor(WorkLifeBalance).L                                                                                         0.000
factor(WorkLifeBalance).Q                                                                                         0.001
factor(WorkLifeBalance).C                                                                                         0.000
DailyRate                                                                                                        -2.975
factor(Department)Research & Development                                                                          0.003
factor(Department)Sales                                                                                          -0.003
factor(Education).L                                                                                               0.002
factor(Education).Q                                                                                               0.001
factor(Education).C                                                                                              -0.003
factor(Education)^4                                                                                               0.000
EducationFieldLife Sciences                                                                                      -0.002
EducationFieldMarketing                                                                                          -0.001
EducationFieldMedical                                                                                            -0.002
EducationFieldOther                                                                                              -0.001
EducationFieldTechnical Degree                                                                                    0.000
factor(JobInvolvement).L                                                                                         -0.005
factor(JobInvolvement).Q                                                                                          0.001
factor(JobInvolvement).C                                                                                         -0.006
factor(JobLevel)2                                                                                                -0.004
factor(JobLevel)3                                                                                                -0.003
factor(JobLevel)4                                                                                                 0.001
factor(JobLevel)5                                                                                                 0.002
factor(JobSatisfaction).L                                                                                        -0.005
factor(JobSatisfaction).Q                                                                                        -0.001
factor(JobSatisfaction).C                                                                                         0.000
factor(EnvironmentSatisfaction).L                                                                                 0.001
factor(EnvironmentSatisfaction).Q                                                                                 0.005
factor(EnvironmentSatisfaction).C                                                                                -0.003
factor(Gender)Male                                                                                               -0.002
factor(JobRole)Human Resources                                                                                    0.004
factor(JobRole)Laboratory Technician                                                                              0.004
factor(JobRole)Manager                                                                                           -0.008
factor(JobRole)Manufacturing Director                                                                            -0.003
factor(JobRole)Research Director                                                                                 -0.004
factor(JobRole)Research Scientist                                                                                 0.003
factor(JobRole)Sales Executive                                                                                    0.015
factor(JobRole)Sales Representative                                                                               0.014
MonthlyIncome                                                                                                    -2.153
HourlyRate                                                                                                       -0.738
factor(OverTime)1                                                                                                -0.140
NumCompaniesWorked                                                                                                6.778
factor(PerformanceRating).L                                                                                      -1.632
factor(RelationshipSatisfaction).L                                                                               -7.755
factor(RelationshipSatisfaction).Q                                                                                2.875
factor(RelationshipSatisfaction).C                                                                               -1.471
factor(StockOptionLevel).L                                                                                        0.235
factor(StockOptionLevel).Q                                                                                        0.252
factor(StockOptionLevel).C                                                                                       -1.759
TotalWorkingYears                                                                                                -2.284
TrainingTimesLastYear                                                                                            -2.715
PercentSalaryHike                                                                                                 1.854
YearsAtCompany                                                                                                    1.561
YearsSinceLastPromotion                                                                                          -0.482
YearsWithCurrManager                                                                                             -3.642
factor(BusinessTravel)Travel_Frequently:DistanceFromHome                                                          0.001
factor(BusinessTravel)Travel_Rarely:DistanceFromHome                                                              0.001
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married                                              0.002
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married                                                  0.002
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Single                                               0.002
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Single                                                   0.002
DistanceFromHome:factor(MaritalStatus)Married                                                                     0.001
DistanceFromHome:factor(MaritalStatus)Single                                                                      0.002
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).L                                                 0.000
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).L                                                     0.000
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).Q                                                -0.001
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).Q                                                    -0.001
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).C                                                 0.000
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).C                                                     0.000
DistanceFromHome:factor(WorkLifeBalance).L                                                                        0.000
DistanceFromHome:factor(WorkLifeBalance).Q                                                                       -0.001
DistanceFromHome:factor(WorkLifeBalance).C                                                                        0.000
factor(MaritalStatus)Married:factor(WorkLifeBalance).L                                                            0.000
factor(MaritalStatus)Single:factor(WorkLifeBalance).L                                                             0.004
factor(MaritalStatus)Married:factor(WorkLifeBalance).Q                                                            0.000
factor(MaritalStatus)Single:factor(WorkLifeBalance).Q                                                            -0.001
factor(MaritalStatus)Married:factor(WorkLifeBalance).C                                                           -0.003
factor(MaritalStatus)Single:factor(WorkLifeBalance).C                                                             0.001
factor(Education).L:EducationFieldLife Sciences                                                                  -0.003
factor(Education).Q:EducationFieldLife Sciences                                                                  -0.002
factor(Education).C:EducationFieldLife Sciences                                                                   0.002
factor(Education)^4:EducationFieldLife Sciences                                                                  -0.001
factor(Education).L:EducationFieldMarketing                                                                      -0.002
factor(Education).Q:EducationFieldMarketing                                                                      -0.001
factor(Education).C:EducationFieldMarketing                                                                       0.003
factor(Education)^4:EducationFieldMarketing                                                                       0.000
factor(Education).L:EducationFieldMedical                                                                        -0.003
factor(Education).Q:EducationFieldMedical                                                                        -0.002
factor(Education).C:EducationFieldMedical                                                                         0.002
factor(Education)^4:EducationFieldMedical                                                                        -0.001
factor(Education).L:EducationFieldOther                                                                          -0.001
factor(Education).Q:EducationFieldOther                                                                          -0.001
factor(Education).C:EducationFieldOther                                                                           0.002
factor(Education)^4:EducationFieldOther                                                                          -0.001
factor(Education).L:EducationFieldTechnical Degree                                                               -0.001
factor(Education).Q:EducationFieldTechnical Degree                                                                0.000
factor(Education).C:EducationFieldTechnical Degree                                                                0.003
factor(Education)^4:EducationFieldTechnical Degree                                                                0.000
factor(JobInvolvement).L:factor(JobLevel)2                                                                        0.001
factor(JobInvolvement).Q:factor(JobLevel)2                                                                       -0.003
factor(JobInvolvement).C:factor(JobLevel)2                                                                        0.001
factor(JobInvolvement).L:factor(JobLevel)3                                                                        0.003
factor(JobInvolvement).Q:factor(JobLevel)3                                                                       -0.003
factor(JobInvolvement).C:factor(JobLevel)3                                                                        0.003
factor(JobInvolvement).L:factor(JobLevel)4                                                                       -0.001
factor(JobInvolvement).Q:factor(JobLevel)4                                                                        0.002
factor(JobInvolvement).C:factor(JobLevel)4                                                                       -0.001
factor(JobInvolvement).L:factor(JobLevel)5                                                                       -0.001
factor(JobInvolvement).Q:factor(JobLevel)5                                                                        0.001
factor(JobInvolvement).C:factor(JobLevel)5                                                                        0.000
factor(JobInvolvement).L:factor(JobSatisfaction).L                                                                0.001
factor(JobInvolvement).Q:factor(JobSatisfaction).L                                                               -0.004
factor(JobInvolvement).C:factor(JobSatisfaction).L                                                                0.002
factor(JobInvolvement).L:factor(JobSatisfaction).Q                                                               -0.002
factor(JobInvolvement).Q:factor(JobSatisfaction).Q                                                               -0.001
factor(JobInvolvement).C:factor(JobSatisfaction).Q                                                               -0.001
factor(JobInvolvement).L:factor(JobSatisfaction).C                                                               -0.001
factor(JobInvolvement).Q:factor(JobSatisfaction).C                                                                0.001
factor(JobInvolvement).C:factor(JobSatisfaction).C                                                               -0.001
factor(JobLevel)2:factor(JobSatisfaction).L                                                                       0.003
factor(JobLevel)3:factor(JobSatisfaction).L                                                                       0.004
factor(JobLevel)4:factor(JobSatisfaction).L                                                                       0.000
factor(JobLevel)5:factor(JobSatisfaction).L                                                                      -0.001
factor(JobLevel)2:factor(JobSatisfaction).Q                                                                      -0.001
factor(JobLevel)3:factor(JobSatisfaction).Q                                                                       0.002
factor(JobLevel)4:factor(JobSatisfaction).Q                                                                       0.001
factor(JobLevel)5:factor(JobSatisfaction).Q                                                                       0.000
factor(JobLevel)2:factor(JobSatisfaction).C                                                                      -0.002
factor(JobLevel)3:factor(JobSatisfaction).C                                                                       0.001
factor(JobLevel)4:factor(JobSatisfaction).C                                                                       0.000
factor(JobLevel)5:factor(JobSatisfaction).C                                                                       0.002
factor(EnvironmentSatisfaction).L:factor(Gender)Male                                                             -0.005
factor(EnvironmentSatisfaction).Q:factor(Gender)Male                                                             -0.003
factor(EnvironmentSatisfaction).C:factor(Gender)Male                                                              0.004
factor(EnvironmentSatisfaction).L:factor(JobRole)Human Resources                                                 -0.003
factor(EnvironmentSatisfaction).Q:factor(JobRole)Human Resources                                                 -0.003
factor(EnvironmentSatisfaction).C:factor(JobRole)Human Resources                                                  0.003
factor(EnvironmentSatisfaction).L:factor(JobRole)Laboratory Technician                                           -0.003
factor(EnvironmentSatisfaction).Q:factor(JobRole)Laboratory Technician                                           -0.005
factor(EnvironmentSatisfaction).C:factor(JobRole)Laboratory Technician                                            0.003
factor(EnvironmentSatisfaction).L:factor(JobRole)Manager                                                          0.002
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manager                                                         -0.003
factor(EnvironmentSatisfaction).C:factor(JobRole)Manager                                                          0.002
factor(EnvironmentSatisfaction).L:factor(JobRole)Manufacturing Director                                          -0.002
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manufacturing Director                                          -0.008
factor(EnvironmentSatisfaction).C:factor(JobRole)Manufacturing Director                                           0.002
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Director                                               -0.003
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Director                                               -0.004
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Director                                                0.008
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Scientist                                              -0.002
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Scientist                                              -0.004
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Scientist                                               0.002
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Executive                                                 -0.002
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Executive                                                 -0.004
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Executive                                                  0.003
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Representative                                            -0.002
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Representative                                            -0.002
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Representative                                             0.002
factor(Gender)Male:factor(JobRole)Human Resources                                                                -0.001
factor(Gender)Male:factor(JobRole)Laboratory Technician                                                           0.002
factor(Gender)Male:factor(JobRole)Manager                                                                         0.008
factor(Gender)Male:factor(JobRole)Manufacturing Director                                                          0.006
factor(Gender)Male:factor(JobRole)Research Director                                                              -0.005
factor(Gender)Male:factor(JobRole)Research Scientist                                                              0.002
factor(Gender)Male:factor(JobRole)Sales Executive                                                                 0.002
factor(Gender)Male:factor(JobRole)Sales Representative                                                            0.001
MonthlyIncome:HourlyRate                                                                                          3.358
MonthlyIncome:factor(OverTime)1                                                                                   3.653
HourlyRate:factor(OverTime)1                                                                                      3.886
factor(StockOptionLevel).L:TotalWorkingYears                                                                      1.140
factor(StockOptionLevel).Q:TotalWorkingYears                                                                      2.906
factor(StockOptionLevel).C:TotalWorkingYears                                                                      2.662
factor(StockOptionLevel).L:TrainingTimesLastYear                                                                 -1.392
factor(StockOptionLevel).Q:TrainingTimesLastYear                                                                  0.863
factor(StockOptionLevel).C:TrainingTimesLastYear                                                                  1.735
TotalWorkingYears:TrainingTimesLastYear                                                                           0.599
PercentSalaryHike:YearsAtCompany                                                                                 -1.093
PercentSalaryHike:YearsSinceLastPromotion                                                                        -0.473
YearsAtCompany:YearsSinceLastPromotion                                                                            0.702
PercentSalaryHike:YearsWithCurrManager                                                                            2.436
YearsAtCompany:YearsWithCurrManager                                                                               1.036
YearsSinceLastPromotion:YearsWithCurrManager                                                                      1.871
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Married                            -0.001
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Married                                -0.001
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Single                             -0.002
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Single                                 -0.002
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).L                                0.000
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).L                                    0.000
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).Q                                0.001
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).Q                                    0.001
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).C                                0.000
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).C                                    0.000
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married:factor(WorkLifeBalance).L                    0.000
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married:factor(WorkLifeBalance).L                       -0.001
                                                                                                                Pr(>|z|)
(Intercept)                                                                                                     0.999983
Age                                                                                                             6.07e-05
factor(BusinessTravel)Travel_Frequently                                                                         0.999543
factor(BusinessTravel)Travel_Rarely                                                                             0.999455
DistanceFromHome                                                                                                0.999483
factor(MaritalStatus)Married                                                                                    0.998533
factor(MaritalStatus)Single                                                                                     0.998421
factor(WorkLifeBalance).L                                                                                       0.999914
factor(WorkLifeBalance).Q                                                                                       0.999372
factor(WorkLifeBalance).C                                                                                       0.999946
DailyRate                                                                                                       0.002929
factor(Department)Research & Development                                                                        0.997515
factor(Department)Sales                                                                                         0.997827
factor(Education).L                                                                                             0.998689
factor(Education).Q                                                                                             0.999594
factor(Education).C                                                                                             0.998001
factor(Education)^4                                                                                             0.999626
EducationFieldLife Sciences                                                                                     0.998567
EducationFieldMarketing                                                                                         0.999486
EducationFieldMedical                                                                                           0.998743
EducationFieldOther                                                                                             0.999149
EducationFieldTechnical Degree                                                                                  0.999667
factor(JobInvolvement).L                                                                                        0.995623
factor(JobInvolvement).Q                                                                                        0.999182
factor(JobInvolvement).C                                                                                        0.995333
factor(JobLevel)2                                                                                               0.996568
factor(JobLevel)3                                                                                               0.997826
factor(JobLevel)4                                                                                               0.998936
factor(JobLevel)5                                                                                               0.998376
factor(JobSatisfaction).L                                                                                       0.995922
factor(JobSatisfaction).Q                                                                                       0.999461
factor(JobSatisfaction).C                                                                                       0.999912
factor(EnvironmentSatisfaction).L                                                                               0.999043
factor(EnvironmentSatisfaction).Q                                                                               0.996274
factor(EnvironmentSatisfaction).C                                                                               0.997872
factor(Gender)Male                                                                                              0.998513
factor(JobRole)Human Resources                                                                                  0.996774
factor(JobRole)Laboratory Technician                                                                            0.997094
factor(JobRole)Manager                                                                                          0.993528
factor(JobRole)Manufacturing Director                                                                           0.997459
factor(JobRole)Research Director                                                                                0.997137
factor(JobRole)Research Scientist                                                                               0.997889
factor(JobRole)Sales Executive                                                                                  0.987898
factor(JobRole)Sales Representative                                                                             0.989208
MonthlyIncome                                                                                                   0.031297
HourlyRate                                                                                                      0.460351
factor(OverTime)1                                                                                               0.888732
NumCompaniesWorked                                                                                              1.21e-11
factor(PerformanceRating).L                                                                                     0.102673
factor(RelationshipSatisfaction).L                                                                              8.86e-15
factor(RelationshipSatisfaction).Q                                                                              0.004042
factor(RelationshipSatisfaction).C                                                                              0.141275
factor(StockOptionLevel).L                                                                                      0.814290
factor(StockOptionLevel).Q                                                                                      0.801319
factor(StockOptionLevel).C                                                                                      0.078572
TotalWorkingYears                                                                                               0.022367
TrainingTimesLastYear                                                                                           0.006627
PercentSalaryHike                                                                                               0.063778
YearsAtCompany                                                                                                  0.118556
YearsSinceLastPromotion                                                                                         0.630040
YearsWithCurrManager                                                                                            0.000271
factor(BusinessTravel)Travel_Frequently:DistanceFromHome                                                        0.999441
factor(BusinessTravel)Travel_Rarely:DistanceFromHome                                                            0.999351
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married                                            0.998361
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married                                                0.998365
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Single                                             0.998379
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Single                                                 0.998348
DistanceFromHome:factor(MaritalStatus)Married                                                                   0.999075
DistanceFromHome:factor(MaritalStatus)Single                                                                    0.998330
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).L                                               0.999885
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).L                                                   0.999889
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).Q                                               0.999246
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).Q                                                   0.999244
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).C                                               0.999976
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).C                                                   0.999887
DistanceFromHome:factor(WorkLifeBalance).L                                                                      0.999925
DistanceFromHome:factor(WorkLifeBalance).Q                                                                      0.999500
DistanceFromHome:factor(WorkLifeBalance).C                                                                      0.999998
factor(MaritalStatus)Married:factor(WorkLifeBalance).L                                                          0.999728
factor(MaritalStatus)Single:factor(WorkLifeBalance).L                                                           0.997162
factor(MaritalStatus)Married:factor(WorkLifeBalance).Q                                                          0.999795
factor(MaritalStatus)Single:factor(WorkLifeBalance).Q                                                           0.998941
factor(MaritalStatus)Married:factor(WorkLifeBalance).C                                                          0.997297
factor(MaritalStatus)Single:factor(WorkLifeBalance).C                                                           0.999511
factor(Education).L:EducationFieldLife Sciences                                                                 0.997955
factor(Education).Q:EducationFieldLife Sciences                                                                 0.998348
factor(Education).C:EducationFieldLife Sciences                                                                 0.998306
factor(Education)^4:EducationFieldLife Sciences                                                                 0.999419
factor(Education).L:EducationFieldMarketing                                                                     0.998513
factor(Education).Q:EducationFieldMarketing                                                                     0.999513
factor(Education).C:EducationFieldMarketing                                                                     0.997955
factor(Education)^4:EducationFieldMarketing                                                                     0.999644
factor(Education).L:EducationFieldMedical                                                                       0.997633
factor(Education).Q:EducationFieldMedical                                                                       0.998431
factor(Education).C:EducationFieldMedical                                                                       0.998290
factor(Education)^4:EducationFieldMedical                                                                       0.999347
factor(Education).L:EducationFieldOther                                                                         0.999300
factor(Education).Q:EducationFieldOther                                                                         0.999475
factor(Education).C:EducationFieldOther                                                                         0.998731
factor(Education)^4:EducationFieldOther                                                                         0.999514
factor(Education).L:EducationFieldTechnical Degree                                                              0.999363
factor(Education).Q:EducationFieldTechnical Degree                                                              0.999874
factor(Education).C:EducationFieldTechnical Degree                                                              0.997871
factor(Education)^4:EducationFieldTechnical Degree                                                              0.999899
factor(JobInvolvement).L:factor(JobLevel)2                                                                      0.999583
factor(JobInvolvement).Q:factor(JobLevel)2                                                                      0.997580
factor(JobInvolvement).C:factor(JobLevel)2                                                                      0.999372
factor(JobInvolvement).L:factor(JobLevel)3                                                                      0.997211
factor(JobInvolvement).Q:factor(JobLevel)3                                                                      0.997805
factor(JobInvolvement).C:factor(JobLevel)3                                                                      0.997708
factor(JobInvolvement).L:factor(JobLevel)4                                                                      0.999035
factor(JobInvolvement).Q:factor(JobLevel)4                                                                      0.998522
factor(JobInvolvement).C:factor(JobLevel)4                                                                      0.998825
factor(JobInvolvement).L:factor(JobLevel)5                                                                      0.999411
factor(JobInvolvement).Q:factor(JobLevel)5                                                                      0.999229
factor(JobInvolvement).C:factor(JobLevel)5                                                                      0.999723
factor(JobInvolvement).L:factor(JobSatisfaction).L                                                              0.999557
factor(JobInvolvement).Q:factor(JobSatisfaction).L                                                              0.996497
factor(JobInvolvement).C:factor(JobSatisfaction).L                                                              0.998010
factor(JobInvolvement).L:factor(JobSatisfaction).Q                                                              0.998419
factor(JobInvolvement).Q:factor(JobSatisfaction).Q                                                              0.999177
factor(JobInvolvement).C:factor(JobSatisfaction).Q                                                              0.998836
factor(JobInvolvement).L:factor(JobSatisfaction).C                                                              0.998808
factor(JobInvolvement).Q:factor(JobSatisfaction).C                                                              0.999327
factor(JobInvolvement).C:factor(JobSatisfaction).C                                                              0.999112
factor(JobLevel)2:factor(JobSatisfaction).L                                                                     0.997473
factor(JobLevel)3:factor(JobSatisfaction).L                                                                     0.997148
factor(JobLevel)4:factor(JobSatisfaction).L                                                                     0.999822
factor(JobLevel)5:factor(JobSatisfaction).L                                                                     0.999338
factor(JobLevel)2:factor(JobSatisfaction).Q                                                                     0.998884
factor(JobLevel)3:factor(JobSatisfaction).Q                                                                     0.998559
factor(JobLevel)4:factor(JobSatisfaction).Q                                                                     0.999282
factor(JobLevel)5:factor(JobSatisfaction).Q                                                                     0.999725
factor(JobLevel)2:factor(JobSatisfaction).C                                                                     0.998792
factor(JobLevel)3:factor(JobSatisfaction).C                                                                     0.999568
factor(JobLevel)4:factor(JobSatisfaction).C                                                                     0.999644
factor(JobLevel)5:factor(JobSatisfaction).C                                                                     0.998333
factor(EnvironmentSatisfaction).L:factor(Gender)Male                                                            0.996129
factor(EnvironmentSatisfaction).Q:factor(Gender)Male                                                            0.997405
factor(EnvironmentSatisfaction).C:factor(Gender)Male                                                            0.996473
factor(EnvironmentSatisfaction).L:factor(JobRole)Human Resources                                                0.997436
factor(EnvironmentSatisfaction).Q:factor(JobRole)Human Resources                                                0.997239
factor(EnvironmentSatisfaction).C:factor(JobRole)Human Resources                                                0.997686
factor(EnvironmentSatisfaction).L:factor(JobRole)Laboratory Technician                                          0.997922
factor(EnvironmentSatisfaction).Q:factor(JobRole)Laboratory Technician                                          0.996063
factor(EnvironmentSatisfaction).C:factor(JobRole)Laboratory Technician                                          0.997776
factor(EnvironmentSatisfaction).L:factor(JobRole)Manager                                                        0.998372
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manager                                                        0.997575
factor(EnvironmentSatisfaction).C:factor(JobRole)Manager                                                        0.998376
factor(EnvironmentSatisfaction).L:factor(JobRole)Manufacturing Director                                         0.998726
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manufacturing Director                                         0.993965
factor(EnvironmentSatisfaction).C:factor(JobRole)Manufacturing Director                                         0.998178
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Director                                              0.997314
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Director                                              0.997121
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Director                                              0.993921
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Scientist                                             0.998086
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Scientist                                             0.996998
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Scientist                                             0.998390
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Executive                                                0.998393
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Executive                                                0.996684
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Executive                                                0.997785
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Representative                                           0.998285
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Representative                                           0.998599
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Representative                                           0.998566
factor(Gender)Male:factor(JobRole)Human Resources                                                               0.999241
factor(Gender)Male:factor(JobRole)Laboratory Technician                                                         0.998012
factor(Gender)Male:factor(JobRole)Manager                                                                       0.993826
factor(Gender)Male:factor(JobRole)Manufacturing Director                                                        0.995179
factor(Gender)Male:factor(JobRole)Research Director                                                             0.996409
factor(Gender)Male:factor(JobRole)Research Scientist                                                            0.998039
factor(Gender)Male:factor(JobRole)Sales Executive                                                               0.998021
factor(Gender)Male:factor(JobRole)Sales Representative                                                          0.999583
MonthlyIncome:HourlyRate                                                                                        0.000785
MonthlyIncome:factor(OverTime)1                                                                                 0.000259
HourlyRate:factor(OverTime)1                                                                                    0.000102
factor(StockOptionLevel).L:TotalWorkingYears                                                                    0.254398
factor(StockOptionLevel).Q:TotalWorkingYears                                                                    0.003660
factor(StockOptionLevel).C:TotalWorkingYears                                                                    0.007764
factor(StockOptionLevel).L:TrainingTimesLastYear                                                                0.163922
factor(StockOptionLevel).Q:TrainingTimesLastYear                                                                0.387976
factor(StockOptionLevel).C:TrainingTimesLastYear                                                                0.082746
TotalWorkingYears:TrainingTimesLastYear                                                                         0.549277
PercentSalaryHike:YearsAtCompany                                                                                0.274252
PercentSalaryHike:YearsSinceLastPromotion                                                                       0.635982
YearsAtCompany:YearsSinceLastPromotion                                                                          0.482535
PercentSalaryHike:YearsWithCurrManager                                                                          0.014842
YearsAtCompany:YearsWithCurrManager                                                                             0.300096
YearsSinceLastPromotion:YearsWithCurrManager                                                                    0.061365
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Married                           0.998897
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Married                               0.998954
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Single                            0.998329
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Single                                0.998262
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).L                              0.999950
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).L                                  0.999917
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).Q                              0.999452
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).Q                                  0.999381
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).C                              0.999958
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).C                                  0.999872
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married:factor(WorkLifeBalance).L                  0.999656
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married:factor(WorkLifeBalance).L                      0.999539
                                                                                                                   
(Intercept)                                                                                                        
Age                                                                                                             ***
factor(BusinessTravel)Travel_Frequently                                                                            
factor(BusinessTravel)Travel_Rarely                                                                                
DistanceFromHome                                                                                                   
factor(MaritalStatus)Married                                                                                       
factor(MaritalStatus)Single                                                                                        
factor(WorkLifeBalance).L                                                                                          
factor(WorkLifeBalance).Q                                                                                          
factor(WorkLifeBalance).C                                                                                          
DailyRate                                                                                                       ** 
factor(Department)Research & Development                                                                           
factor(Department)Sales                                                                                            
factor(Education).L                                                                                                
factor(Education).Q                                                                                                
factor(Education).C                                                                                                
factor(Education)^4                                                                                                
EducationFieldLife Sciences                                                                                        
EducationFieldMarketing                                                                                            
EducationFieldMedical                                                                                              
EducationFieldOther                                                                                                
EducationFieldTechnical Degree                                                                                     
factor(JobInvolvement).L                                                                                           
factor(JobInvolvement).Q                                                                                           
factor(JobInvolvement).C                                                                                           
factor(JobLevel)2                                                                                                  
factor(JobLevel)3                                                                                                  
factor(JobLevel)4                                                                                                  
factor(JobLevel)5                                                                                                  
factor(JobSatisfaction).L                                                                                          
factor(JobSatisfaction).Q                                                                                          
factor(JobSatisfaction).C                                                                                          
factor(EnvironmentSatisfaction).L                                                                                  
factor(EnvironmentSatisfaction).Q                                                                                  
factor(EnvironmentSatisfaction).C                                                                                  
factor(Gender)Male                                                                                                 
factor(JobRole)Human Resources                                                                                     
factor(JobRole)Laboratory Technician                                                                               
factor(JobRole)Manager                                                                                             
factor(JobRole)Manufacturing Director                                                                              
factor(JobRole)Research Director                                                                                   
factor(JobRole)Research Scientist                                                                                  
factor(JobRole)Sales Executive                                                                                     
factor(JobRole)Sales Representative                                                                                
MonthlyIncome                                                                                                   *  
HourlyRate                                                                                                         
factor(OverTime)1                                                                                                  
NumCompaniesWorked                                                                                              ***
factor(PerformanceRating).L                                                                                        
factor(RelationshipSatisfaction).L                                                                              ***
factor(RelationshipSatisfaction).Q                                                                              ** 
factor(RelationshipSatisfaction).C                                                                                 
factor(StockOptionLevel).L                                                                                         
factor(StockOptionLevel).Q                                                                                         
factor(StockOptionLevel).C                                                                                      .  
TotalWorkingYears                                                                                               *  
TrainingTimesLastYear                                                                                           ** 
PercentSalaryHike                                                                                               .  
YearsAtCompany                                                                                                     
YearsSinceLastPromotion                                                                                            
YearsWithCurrManager                                                                                            ***
factor(BusinessTravel)Travel_Frequently:DistanceFromHome                                                           
factor(BusinessTravel)Travel_Rarely:DistanceFromHome                                                               
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married                                               
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married                                                   
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Single                                                
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Single                                                    
DistanceFromHome:factor(MaritalStatus)Married                                                                      
DistanceFromHome:factor(MaritalStatus)Single                                                                       
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).L                                                  
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).L                                                      
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).Q                                                  
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).Q                                                      
factor(BusinessTravel)Travel_Frequently:factor(WorkLifeBalance).C                                                  
factor(BusinessTravel)Travel_Rarely:factor(WorkLifeBalance).C                                                      
DistanceFromHome:factor(WorkLifeBalance).L                                                                         
DistanceFromHome:factor(WorkLifeBalance).Q                                                                         
DistanceFromHome:factor(WorkLifeBalance).C                                                                         
factor(MaritalStatus)Married:factor(WorkLifeBalance).L                                                             
factor(MaritalStatus)Single:factor(WorkLifeBalance).L                                                              
factor(MaritalStatus)Married:factor(WorkLifeBalance).Q                                                             
factor(MaritalStatus)Single:factor(WorkLifeBalance).Q                                                              
factor(MaritalStatus)Married:factor(WorkLifeBalance).C                                                             
factor(MaritalStatus)Single:factor(WorkLifeBalance).C                                                              
factor(Education).L:EducationFieldLife Sciences                                                                    
factor(Education).Q:EducationFieldLife Sciences                                                                    
factor(Education).C:EducationFieldLife Sciences                                                                    
factor(Education)^4:EducationFieldLife Sciences                                                                    
factor(Education).L:EducationFieldMarketing                                                                        
factor(Education).Q:EducationFieldMarketing                                                                        
factor(Education).C:EducationFieldMarketing                                                                        
factor(Education)^4:EducationFieldMarketing                                                                        
factor(Education).L:EducationFieldMedical                                                                          
factor(Education).Q:EducationFieldMedical                                                                          
factor(Education).C:EducationFieldMedical                                                                          
factor(Education)^4:EducationFieldMedical                                                                          
factor(Education).L:EducationFieldOther                                                                            
factor(Education).Q:EducationFieldOther                                                                            
factor(Education).C:EducationFieldOther                                                                            
factor(Education)^4:EducationFieldOther                                                                            
factor(Education).L:EducationFieldTechnical Degree                                                                 
factor(Education).Q:EducationFieldTechnical Degree                                                                 
factor(Education).C:EducationFieldTechnical Degree                                                                 
factor(Education)^4:EducationFieldTechnical Degree                                                                 
factor(JobInvolvement).L:factor(JobLevel)2                                                                         
factor(JobInvolvement).Q:factor(JobLevel)2                                                                         
factor(JobInvolvement).C:factor(JobLevel)2                                                                         
factor(JobInvolvement).L:factor(JobLevel)3                                                                         
factor(JobInvolvement).Q:factor(JobLevel)3                                                                         
factor(JobInvolvement).C:factor(JobLevel)3                                                                         
factor(JobInvolvement).L:factor(JobLevel)4                                                                         
factor(JobInvolvement).Q:factor(JobLevel)4                                                                         
factor(JobInvolvement).C:factor(JobLevel)4                                                                         
factor(JobInvolvement).L:factor(JobLevel)5                                                                         
factor(JobInvolvement).Q:factor(JobLevel)5                                                                         
factor(JobInvolvement).C:factor(JobLevel)5                                                                         
factor(JobInvolvement).L:factor(JobSatisfaction).L                                                                 
factor(JobInvolvement).Q:factor(JobSatisfaction).L                                                                 
factor(JobInvolvement).C:factor(JobSatisfaction).L                                                                 
factor(JobInvolvement).L:factor(JobSatisfaction).Q                                                                 
factor(JobInvolvement).Q:factor(JobSatisfaction).Q                                                                 
factor(JobInvolvement).C:factor(JobSatisfaction).Q                                                                 
factor(JobInvolvement).L:factor(JobSatisfaction).C                                                                 
factor(JobInvolvement).Q:factor(JobSatisfaction).C                                                                 
factor(JobInvolvement).C:factor(JobSatisfaction).C                                                                 
factor(JobLevel)2:factor(JobSatisfaction).L                                                                        
factor(JobLevel)3:factor(JobSatisfaction).L                                                                        
factor(JobLevel)4:factor(JobSatisfaction).L                                                                        
factor(JobLevel)5:factor(JobSatisfaction).L                                                                        
factor(JobLevel)2:factor(JobSatisfaction).Q                                                                        
factor(JobLevel)3:factor(JobSatisfaction).Q                                                                        
factor(JobLevel)4:factor(JobSatisfaction).Q                                                                        
factor(JobLevel)5:factor(JobSatisfaction).Q                                                                        
factor(JobLevel)2:factor(JobSatisfaction).C                                                                        
factor(JobLevel)3:factor(JobSatisfaction).C                                                                        
factor(JobLevel)4:factor(JobSatisfaction).C                                                                        
factor(JobLevel)5:factor(JobSatisfaction).C                                                                        
factor(EnvironmentSatisfaction).L:factor(Gender)Male                                                               
factor(EnvironmentSatisfaction).Q:factor(Gender)Male                                                               
factor(EnvironmentSatisfaction).C:factor(Gender)Male                                                               
factor(EnvironmentSatisfaction).L:factor(JobRole)Human Resources                                                   
factor(EnvironmentSatisfaction).Q:factor(JobRole)Human Resources                                                   
factor(EnvironmentSatisfaction).C:factor(JobRole)Human Resources                                                   
factor(EnvironmentSatisfaction).L:factor(JobRole)Laboratory Technician                                             
factor(EnvironmentSatisfaction).Q:factor(JobRole)Laboratory Technician                                             
factor(EnvironmentSatisfaction).C:factor(JobRole)Laboratory Technician                                             
factor(EnvironmentSatisfaction).L:factor(JobRole)Manager                                                           
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manager                                                           
factor(EnvironmentSatisfaction).C:factor(JobRole)Manager                                                           
factor(EnvironmentSatisfaction).L:factor(JobRole)Manufacturing Director                                            
factor(EnvironmentSatisfaction).Q:factor(JobRole)Manufacturing Director                                            
factor(EnvironmentSatisfaction).C:factor(JobRole)Manufacturing Director                                            
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Director                                                 
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Director                                                 
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Director                                                 
factor(EnvironmentSatisfaction).L:factor(JobRole)Research Scientist                                                
factor(EnvironmentSatisfaction).Q:factor(JobRole)Research Scientist                                                
factor(EnvironmentSatisfaction).C:factor(JobRole)Research Scientist                                                
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Executive                                                   
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Executive                                                   
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Executive                                                   
factor(EnvironmentSatisfaction).L:factor(JobRole)Sales Representative                                              
factor(EnvironmentSatisfaction).Q:factor(JobRole)Sales Representative                                              
factor(EnvironmentSatisfaction).C:factor(JobRole)Sales Representative                                              
factor(Gender)Male:factor(JobRole)Human Resources                                                                  
factor(Gender)Male:factor(JobRole)Laboratory Technician                                                            
factor(Gender)Male:factor(JobRole)Manager                                                                          
factor(Gender)Male:factor(JobRole)Manufacturing Director                                                           
factor(Gender)Male:factor(JobRole)Research Director                                                                
factor(Gender)Male:factor(JobRole)Research Scientist                                                               
factor(Gender)Male:factor(JobRole)Sales Executive                                                                  
factor(Gender)Male:factor(JobRole)Sales Representative                                                             
MonthlyIncome:HourlyRate                                                                                        ***
MonthlyIncome:factor(OverTime)1                                                                                 ***
HourlyRate:factor(OverTime)1                                                                                    ***
factor(StockOptionLevel).L:TotalWorkingYears                                                                       
factor(StockOptionLevel).Q:TotalWorkingYears                                                                    ** 
factor(StockOptionLevel).C:TotalWorkingYears                                                                    ** 
factor(StockOptionLevel).L:TrainingTimesLastYear                                                                   
factor(StockOptionLevel).Q:TrainingTimesLastYear                                                                   
factor(StockOptionLevel).C:TrainingTimesLastYear                                                                .  
TotalWorkingYears:TrainingTimesLastYear                                                                            
PercentSalaryHike:YearsAtCompany                                                                                   
PercentSalaryHike:YearsSinceLastPromotion                                                                          
YearsAtCompany:YearsSinceLastPromotion                                                                             
PercentSalaryHike:YearsWithCurrManager                                                                          *  
YearsAtCompany:YearsWithCurrManager                                                                                
YearsSinceLastPromotion:YearsWithCurrManager                                                                    .  
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Married                              
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Married                                  
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(MaritalStatus)Single                               
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(MaritalStatus)Single                                   
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).L                                 
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).L                                     
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).Q                                 
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).Q                                     
factor(BusinessTravel)Travel_Frequently:DistanceFromHome:factor(WorkLifeBalance).C                                 
factor(BusinessTravel)Travel_Rarely:DistanceFromHome:factor(WorkLifeBalance).C                                     
factor(BusinessTravel)Travel_Frequently:factor(MaritalStatus)Married:factor(WorkLifeBalance).L                     
factor(BusinessTravel)Travel_Rarely:factor(MaritalStatus)Married:factor(WorkLifeBalance).L                         
 [ reached getOption("max.print") -- omitted 97 rows ]
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 4154.4  on 2999  degrees of freedom
Residual deviance:  945.9  on 2709  degrees of freedom
AIC: 1527.9

Number of Fisher Scoring iterations: 21
AIC(logmod)
[1] 1527.899
BIC(logmod)
[1] 3275.752

Exponentiating we get the Odds Ratio

Odds Ratios You can also exponentiate the coefficients and interpret them as odds-ratios.

ln a P(Attrition=1)/P(Attrition=0)

R will do this computation for you. To get the exponentiated coefficients, you tell R that you want to exponentiate (exp), and that the object you want to exponentiate is called coefficients and it is part of mylogit (coef(logmod)). We can use the same logic to get odds ratios and their confidence intervals, by exponentiating the confidence intervals from before. To put it all in one table, we use cbind to bind the coefficients and confidence intervals column-wise.

#cbind(exp.coef=exp(logmod$coef),exp(confint(logmod)))

If we use R’s diagnostic plot, the first one is the scatterplot of the residuals, against predicted values (the score actually).

plot(logmod,which=1)

plot(predict(logmod),residuals(logmod))
abline(h=0,lty=2,col="grey")

Tests for Coefficients: Walds Tests

Test statistic:

z=bj/se(bj)

this is approximately N(0,1) under H0

Attrition Example: #fitting the logistic model

#summary(logmod)

Test for subset of variables:

This is likelihood ratio test that compares the log likelihoods of the two models

Λ=2 ln L(Full model)/L(Reduced model)

Asymptotically, Λ has a Chi-square distribution. Thus the test statistics is aproximate Chi-square.

Test statistic:

χ2=2 log L(Full model) − 2 log L(Reduced model)

where L()= the likelihood function

Under the null hypothesis, the test statistic is approximately Chi-squared with df=k (number of additional variables in the full model)

Deviance

The Deviance of a model is

Deviance = D = −2 log L(model)

So, the tests statistic for the above situation is

χ2=D(Reduced model)−D(Full model)

Model Overall Test:

Test statistic:

Deviance= χ^2=-2 log L(reduced)/L(full) = D(reduced)-D(full)

Approximately χ2 with df=n−p

anova(logmod)
glm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: algorithm did not convergeglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: algorithm did not convergeglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurredglm.fit: fitted probabilities numerically 0 or 1 occurred
Analysis of Deviance Table

Model: binomial, link: logit

Response: factor(Attrition)

Terms added sequentially (first to last)

                                                                                      Df Deviance Resid. Df Resid. Dev
NULL                                                                                                   2999     4154.4
Age                                                                                    1    130.4      2998     4024.0
factor(BusinessTravel)                                                                 2     74.9      2996     3949.2
DistanceFromHome                                                                       1     43.2      2995     3905.9
factor(MaritalStatus)                                                                  2    120.7      2993     3785.2
factor(WorkLifeBalance)                                                                3     50.8      2990     3734.4
DailyRate                                                                              1      5.4      2989     3729.0
factor(Department)                                                                     2     41.6      2987     3687.4
factor(Education)                                                                      4      8.0      2983     3679.3
EducationField                                                                         5     71.1      2978     3608.2
factor(JobInvolvement)                                                                 3    109.9      2975     3498.4
factor(JobLevel)                                                                       4    263.6      2971     3234.8
factor(JobSatisfaction)                                                                3     65.4      2968     3169.4
factor(EnvironmentSatisfaction)                                                        3     73.4      2965     3096.0
factor(Gender)                                                                         1      8.2      2964     3087.8
factor(JobRole)                                                                        8     76.8      2956     3010.9
MonthlyIncome                                                                          1      0.8      2955     3010.2
HourlyRate                                                                             1      2.0      2954     3008.2
factor(OverTime)                                                                       1    346.0      2953     2662.2
NumCompaniesWorked                                                                     1     73.5      2952     2588.7
factor(PerformanceRating)                                                              1      0.4      2951     2588.3
factor(RelationshipSatisfaction)                                                       3     43.1      2948     2545.2
factor(StockOptionLevel)                                                               3     33.9      2945     2511.2
TotalWorkingYears                                                                      1      0.9      2944     2510.3
TrainingTimesLastYear                                                                  1     15.2      2943     2495.1
PercentSalaryHike                                                                      1     12.4      2942     2482.7
YearsAtCompany                                                                         1      8.1      2941     2474.6
YearsSinceLastPromotion                                                                1     22.3      2940     2452.4
YearsWithCurrManager                                                                   1    107.7      2939     2344.7
factor(BusinessTravel):DistanceFromHome                                                2     19.6      2937     2325.1
factor(BusinessTravel):factor(MaritalStatus)                                           4     37.8      2933     2287.3
DistanceFromHome:factor(MaritalStatus)                                                 2      1.3      2931     2286.1
factor(BusinessTravel):factor(WorkLifeBalance)                                         6     24.0      2925     2262.1
DistanceFromHome:factor(WorkLifeBalance)                                               3     10.4      2922     2251.7
factor(MaritalStatus):factor(WorkLifeBalance)                                          6     21.3      2916     2230.4
factor(Education):EducationField                                                      20    137.6      2896     2092.9
factor(JobInvolvement):factor(JobLevel)                                               12     73.4      2884     2019.5
factor(JobInvolvement):factor(JobSatisfaction)                                         9     40.7      2875     1978.8
factor(JobLevel):factor(JobSatisfaction)                                              12     79.2      2863     1899.6
factor(EnvironmentSatisfaction):factor(Gender)                                         3      5.9      2860     1893.7
factor(EnvironmentSatisfaction):factor(JobRole)                                       24    109.4      2836     1784.3
factor(Gender):factor(JobRole)                                                         8     56.4      2828     1727.8
MonthlyIncome:HourlyRate                                                               1     11.2      2827     1716.7
MonthlyIncome:factor(OverTime)                                                         1      5.0      2826     1711.6
HourlyRate:factor(OverTime)                                                            1      1.1      2825     1710.6
factor(StockOptionLevel):TotalWorkingYears                                             3     47.5      2822     1663.1
factor(StockOptionLevel):TrainingTimesLastYear                                         3     37.3      2819     1625.8
TotalWorkingYears:TrainingTimesLastYear                                                1      0.8      2818     1625.0
PercentSalaryHike:YearsAtCompany                                                       1      4.0      2817     1621.0
PercentSalaryHike:YearsSinceLastPromotion                                              1      3.0      2816     1618.0
YearsAtCompany:YearsSinceLastPromotion                                                 1     21.2      2815     1596.8
PercentSalaryHike:YearsWithCurrManager                                                 1      1.2      2814     1595.5
YearsAtCompany:YearsWithCurrManager                                                    1     15.0      2813     1580.6
YearsSinceLastPromotion:YearsWithCurrManager                                           1     30.9      2812     1549.7
factor(BusinessTravel):DistanceFromHome:factor(MaritalStatus)                          4     21.3      2808     1528.4
factor(BusinessTravel):DistanceFromHome:factor(WorkLifeBalance)                        6     40.7      2802     1487.7
factor(BusinessTravel):factor(MaritalStatus):factor(WorkLifeBalance)                  12     95.3      2790     1392.4
DistanceFromHome:factor(MaritalStatus):factor(WorkLifeBalance)                         6     39.0      2784     1353.4
factor(JobInvolvement):factor(JobLevel):factor(JobSatisfaction)                       31      0.0      2753    25446.8
factor(EnvironmentSatisfaction):factor(Gender):factor(JobRole)                        24  24370.8      2729     1076.0
MonthlyIncome:HourlyRate:factor(OverTime)                                              1      0.0      2728    24005.1
factor(StockOptionLevel):TotalWorkingYears:TrainingTimesLastYear                       3  22997.8      2725     1007.3
PercentSalaryHike:YearsAtCompany:YearsSinceLastPromotion                               1      5.4      2724     1001.9
PercentSalaryHike:YearsAtCompany:YearsWithCurrManager                                  1      0.9      2723     1001.0
PercentSalaryHike:YearsSinceLastPromotion:YearsWithCurrManager                         1      1.7      2722      999.4
YearsAtCompany:YearsSinceLastPromotion:YearsWithCurrManager                            1     24.1      2721      975.3
factor(BusinessTravel):DistanceFromHome:factor(MaritalStatus):factor(WorkLifeBalance) 11     29.3      2710      946.0
PercentSalaryHike:YearsAtCompany:YearsSinceLastPromotion:YearsWithCurrManager          1      0.1      2709      945.9

Now calculate the overall “Pseudo R-squared” and its p-value

ll.null <- logmod$null.deviance/-2
ll.proposed <- logmod$deviance/-2
ll.null
[1] -2077.198
ll.proposed
[1] -472.9497

McFadden’s Pseudo R^2 = [ LL(Null) - LL(Proposed) ] / LL(Null)

(ll.null - ll.proposed) / ll.null
[1] 0.7723137

The p-value for the R^2

1 - pchisq(2*(ll.proposed - ll.null), df=(length(logmod$coefficients)-1))
[1] 0

This means that the model with our regressors and interactions in it is better than the model with no variables.

now we can plot the data

predicted.data <- data.frame(
  probability.of.Attrition=logmod$fitted.values,
  Attrition=data$Attrition)

predicted.data <- predicted.data[order(predicted.data$probability.of.Attrition, decreasing=FALSE),]
predicted.data$rank <- 1:nrow(predicted.data)
summary(predicted.data)
 probability.of.Attrition Attrition      rank       
 Min.   :0.0000000        0:1558    Min.   :   1.0  
 1st Qu.:0.0000474        1:1442    1st Qu.: 750.8  
 Median :0.4753597                  Median :1500.5  
 Mean   :0.4806667                  Mean   :1500.5  
 3rd Qu.:0.9801070                  3rd Qu.:2250.2  
 Max.   :1.0000000                  Max.   :3000.0  
## Lastly, we can plot the predicted probabilities for each sample having
## heart disease and color by whether or not they actually had heart disease
ggplot(data=predicted.data, aes(x=rank, y=probability.of.Attrition)) +
  geom_point(aes(color=Attrition), alpha=1, shape=4, stroke=2) +
  xlab("Index") +
  ylab("Predicted probability of Attrition")

ggsave("attrition_probabilities.pdf")
Saving 7.29 x 4.51 in image

Predicted values (Y vs observations that were classified as positive Y^=1, or negative Y^=0, at a threshold of .45.

S<-predict(logmod,type="response")
Y<-data$Attrition
Ps=(S>.45)*1
rbind(c("","Y^=1",               "Y^=0"),
   c("Y=1", sum((Ps==1)*(Y==1)), sum((Ps!=1)*(Y==1))),
   c("Y=0", sum((Ps==1)*(Y==0)), sum((Ps!=1)*(Y==0))))
     [,1]  [,2]   [,3]  
[1,] ""    "Y^=1" "Y^=0"
[2,] "Y=1" "1403" "39"  
[3,] "Y=0" "113"  "1445"

There are number of methods of evaluating whether a logistic model is a good model. One such way is sensitivity and specificity.

Sensitivity and specificity are statistical measures of the performance of a binary classification test, also known in statistics as classification function:

Sensitivity (also called the true positive rate, or the recall in some fields) measures the proportion of actual positives which are correctly identified as such (e.g., the percentage of sick people who are correctly identified as having the condition), and is complementary to the false negative rate. Sensitivity= true positives/(true positive + false negative)

Specificity (also called the true negative rate) measures the proportion of negatives which are correctly identified as such (e.g., the percentage of healthy people who are correctly identified as not having the condition), and is complementary to the false positive rate. Specificity=true negatives/(true negative + false positives)

FP=sum((Ps==1)*(Y==0))   #false positives
TP=sum((Ps==1)*(Y==1))  #true positives
FN=sum((Ps!=1)*(Y==1))   #false neagtive
TN=sum((Ps!=1)*(Y==0))  #true negative

Compute Sensitivity: TP/(TP+FN)

TP/(TP+FN)
[1] 0.9729542

Compute Specificity: TN/(TN+FP)

TN/(TN+FP)
[1] 0.9274711

Compute the TRP (True positive rate) and FRT (False positive rate)

sum((Ps==1)*(Y==0))/sum(Y==0)   #false positives
[1] 0.07252888
sum((Ps==1)*(Y==1))/sum(Y==1)   #true positives
[1] 0.9729542

AIC and BIC

Additionally, there are four other important metrics - AIC, AICc, BIC and Mallows Cp - that are commonly used for model evaluation and selection. These are an unbiased estimate of the model prediction error MSE. The lower these metrics, the better the model.

AIC stands for (Akaike’s Information Criteria), a metric developped by the Japanese Statistician, Hirotugu Akaike, 1970. The basic idea of AIC is to penalize the inclusion of additional variables to a model. It adds a penalty that increases the error when including additional terms. The lower the AIC, the better the model.

AIC

AIC(logmod)
[1] 1527.899

AICc is a version of AIC corrected for small sample sizes.

BIC (or Bayesian information criteria) is a variant of AIC with a stronger penalty for including additional variables to the model.

BIC

BIC(logmod)

Conclusion

We used several techniques to build a robust Logistic Regression model to predict Attrition of an employee at a given company.

First, we loaded the data into R Studio. Then we converted all variables to factors taking into consideration specific variables that are ordinal in nature.

After summarizing and visualizing our data regressors with respect to Attrition using various common libraries and techniques, we discovered that our Attrition response variable had a minority value of 1 resulting in a significantly unbalanced dataset. If not treated properly, our model would more frequently predict 0. Therefore, we used a common under/over sampling technique to balance our dataset.

We then spent a significant amount of time looking at all of the 35 regressors using our intuition and emperical analysis to determine those variables that had significant interactions. Our primary heuristic used to gague a better model was by minimizing our AIC as we adjusted various interactions within the model. The end result was a pseudo-adjusted R2 value of 0.77 and a p-value of 0 indicating a good model.

We then computed the confusion matrix of our model which consisted of our precision and sensitivity corresponding to our true positive and true negative rates, respectively. Our recall was 0.97 where we predicted 97% of all True Positive samples correctly and we predicted 93% of all True Negative samples correctly.

Finally, we plotted our 3000 predicted values which resulted in an S shaped curve which is to be expected for a Logistic Regression model with a large number of samples.

Overall, we are very pleased with the outcome of our model. Our model showed several features that played a significant role in building a more robust model.

For example, the following interactions we used in our model make intuitive sense:

  1. factor(BusinessTravel) * DistanceFromHome * factor(MaritalStatus) * factor(WorkLifeBalance)

One interpretation for this is that married employees with a family that have a bad work/life balance could lead to attrition as they seek positions that offer a better work/life balance. Conversely, this could also indicate that they stay because the employer values a work/life balance.

  1. factor(JobInvolvement) * factor(JobLevel) * factor(JobSatisfaction)

If you are not involved in your job, you may not be satisfied.

  1. factor(EnvironmentSatisfaction) * factor(Gender) * factor(JobRole)

If you are not happy in your environment due to various social reasons based on say gender imbalance, for example, this can be a key motivator to leave.

  1. MonthlyIncome * HourlyRate * factor(OverTime)

Sometimes employees that feel they should make more will leave for higher wages. Likewise, if you get a lot of overtime, this can typically be a positive aspect for some.

  1. factor(StockOptionLevel) * TotalWorkingYears * TrainingTimesLastYear

The longer you work at a company, the more stock options you are able to obtain. Likewise, if you are not able to receive training, you may become stagnant or bored doing the same thing over and over again.

  1. PercentSalaryHike * YearsAtCompany * YearsSinceLastPromotion * YearsWithCurrManager

Again, depending on how long you have worked at a company, these interactions can lead to leaving if your manager is very bad or they could stay of their manager is great and they stay with the same manager for a long time. Often if you get a long with your manager, the relationship gets better over time.

LS0tCnRpdGxlOiAiSUJNIEF0dHJpdGlvbiAtIEEgTG9naXN0aWMgUmVncmVzc2lvbiBBcHByb2FjaCIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQoKYGBge3J9CnNvdXJjZSgicGFpcnMuciIpCgoKbGlicmFyeShkcGx5cikKbGlicmFyeShnZ3Bsb3QyKQpsaWJyYXJ5KHBhc3RlY3MpCmxpYnJhcnkocHN5Y2gpCmxpYnJhcnkoQW1lbGlhKQps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